Skip to content

Commit 2ab0b13

Browse files
committed
[Profiler] Avoid passing null node to loadProfilerCount
This will become an assertion failure in a future commit.
1 parent 1f80bbe commit 2ab0b13

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/SILGen/SILGenStmt.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,9 @@ void StmtEmitter::visitIfStmt(IfStmt *S) {
752752
LexicalScope trueScope(SGF, S);
753753

754754
auto NumTrueTaken = SGF.loadProfilerCount(S->getThenStmt());
755-
auto NumFalseTaken = SGF.loadProfilerCount(S->getElseStmt());
755+
auto NumFalseTaken = ProfileCounter();
756+
if (auto *Else = S->getElseStmt())
757+
NumFalseTaken = SGF.loadProfilerCount(Else);
756758

757759
SGF.emitStmtCondition(S->getCond(), falseDest, S, NumTrueTaken,
758760
NumFalseTaken);

0 commit comments

Comments
 (0)