Skip to content

Commit fab7752

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
1 parent 396dd73 commit fab7752

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
@@ -1293,9 +1293,17 @@ static bool isReachable(SILBasicBlock *Block) {
12931293
}
12941294
#endif
12951295

1296+
static llvm::cl::opt<bool> SimplifyUnconditionalBranches(
1297+
"simplify-cfg-simplify-unconditional-branches", llvm::cl::init(true));
1298+
12961299
/// simplifyBranchBlock - Simplify a basic block that ends with an unconditional
12971300
/// branch.
12981301
bool SimplifyCFG::simplifyBranchBlock(BranchInst *BI) {
1302+
// If we are asked to not simplify unconditional branches (for testing
1303+
// purposes), exit early.
1304+
if (!SimplifyUnconditionalBranches)
1305+
return false;
1306+
12991307
// First simplify instructions generating branch operands since that
13001308
// can expose CFG simplifications.
13011309
bool Simplified = simplifyBranchOperands(BI->getArgs());

0 commit comments

Comments
 (0)