[PGO] Remove a null check, NFC

The else subexpression of an IfExpr should never be null. The AST
verifier checks for this.
This commit is contained in:
Vedant Kumar
2018-04-04 18:26:13 -07:00
parent daa094e5e0
commit dded2b9b99

View File

@@ -478,21 +478,21 @@ struct PGOMapping : public ASTWalker {
CounterMap[thenExpr] = NextCounter++;
auto thenCount = loadExecutionCount(thenExpr);
LoadedCounterMap[thenExpr] = thenCount;
if (auto elseExpr = IE->getElseExpr()) {
CounterMap[elseExpr] = parent;
auto count = loadExecutionCount(elseExpr);
if (!parent) {
auto thenVal = thenCount.getValue();
for (auto pCount = NextCounter - 1; pCount > 0; --pCount) {
auto cCount = LoadedCounts->Counts[pCount];
if (cCount > thenVal) {
count = cCount;
break;
}
auto elseExpr = IE->getElseExpr();
assert(elseExpr && "An if-expr must have an else subexpression");
CounterMap[elseExpr] = parent;
auto count = loadExecutionCount(elseExpr);
if (!parent) {
auto thenVal = thenCount.getValue();
for (auto pCount = NextCounter - 1; pCount > 0; --pCount) {
auto cCount = LoadedCounts->Counts[pCount];
if (cCount > thenVal) {
count = cCount;
break;
}
}
LoadedCounterMap[elseExpr] = subtract(count, thenCount);
}
LoadedCounterMap[elseExpr] = subtract(count, thenCount);
} else if (isa<AutoClosureExpr>(E) || isa<ClosureExpr>(E)) {
CounterMap[E] = NextCounter++;
auto eCount = loadExecutionCount(E);