Skip to content

Commit 2815429

Browse files
committed
[NFC][SimplifyCFG] HoistThenElseCodeToIf(): after hoisting terminator, do return Changed, not just true
Otherwise, if Changed was still false before that, we would not account for that hoist in NumHoistCommonCode statistic.
1 parent 6282886 commit 2815429

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,7 @@ bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI,
14221422
I2->replaceAllUsesWith(NT);
14231423
NT->takeName(I1);
14241424
}
1425+
Changed = true;
14251426
++NumHoistCommonInstrs;
14261427

14271428
// Ensure terminator gets a debug location, even an unknown one, in case
@@ -1469,7 +1470,7 @@ bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI,
14691470
AddPredecessorToBlock(Succ, BIParent, BB1);
14701471

14711472
EraseTerminatorAndDCECond(BI);
1472-
return true;
1473+
return Changed;
14731474
}
14741475

14751476
// Check lifetime markers.

0 commit comments

Comments
 (0)