[llvm] 2815429 - [NFC][SimplifyCFG] HoistThenElseCodeToIf(): after hoisting terminator, do return Changed, not just true
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 14:33:10 PDT 2020
Author: Roman Lebedev
Date: 2020-07-16T00:32:48+03:00
New Revision: 2815429d08fec06027c4adf81c0b438fb2c72ef0
URL: https://github.com/llvm/llvm-project/commit/2815429d08fec06027c4adf81c0b438fb2c72ef0
DIFF: https://github.com/llvm/llvm-project/commit/2815429d08fec06027c4adf81c0b438fb2c72ef0.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 94445fe0c4d8..5aa929fa1822 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1422,6 +1422,7 @@ bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI,
I2->replaceAllUsesWith(NT);
NT->takeName(I1);
}
+ Changed = true;
++NumHoistCommonInstrs;
// Ensure terminator gets a debug location, even an unknown one, in case
@@ -1469,7 +1470,7 @@ bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI,
AddPredecessorToBlock(Succ, BIParent, BB1);
EraseTerminatorAndDCECond(BI);
- return true;
+ return Changed;
}
// Check lifetime markers.
More information about the llvm-commits
mailing list