mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user