Skip to content

Commit 0618de3

Browse files
committed
[simplify-cfg] Add option sil-simplify-cfg-simplify-unconditional-branches for testing purposes
I am going to use this in a subsequent commit to make sure we do not infinite loop upon a test case. rdar://55861081 (cherry picked from commit fab7752)
1 parent 5624365 commit 0618de3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,9 +1209,17 @@ static bool isReachable(SILBasicBlock *Block) {
12091209
}
12101210
#endif
12111211

1212+
static llvm::cl::opt<bool> SimplifyUnconditionalBranches(
1213+
"simplify-cfg-simplify-unconditional-branches", llvm::cl::init(true));
1214+
12121215
/// simplifyBranchBlock - Simplify a basic block that ends with an unconditional
12131216
/// branch.
12141217
bool SimplifyCFG::simplifyBranchBlock(BranchInst *BI) {
1218+
// If we are asked to not simplify unconditional branches (for testing
1219+
// purposes), exit early.
1220+
if (!SimplifyUnconditionalBranches)
1221+
return false;
1222+
12151223
// First simplify instructions generating branch operands since that
12161224
// can expose CFG simplifications.
12171225
bool Simplified = simplifyBranchOperands(BI->getArgs());

0 commit comments

Comments
 (0)