Skip to content

Commit c697a93

Browse files
bors[bot]vext01
andauthored
29: In SelectionDAG lowering, always emit a branch. r=ptersilie a=vext01 Co-authored-by: Edd Barrett <[email protected]>
2 parents 4c38c71 + 9ec5475 commit c697a93

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ static cl::opt<unsigned> SwitchPeelThreshold(
135135
"switch statement. A value greater than 100 will void this "
136136
"optimization"));
137137

138+
static cl::opt<bool> YkNoFallThrough(
139+
"yk-no-fallthrough", cl::Hidden, cl::init(false),
140+
cl::desc("Always emit a branch even if fallthrough is possible. This "
141+
"is required for the yk JIT, so that the machine IR has the "
142+
"same block structure as the high-level IR"));
143+
138144
// Limit the width of DAG chains. This is important in general to prevent
139145
// DAG-based analysis from blowing up. For example, alias analysis and
140146
// load clustering may not complete in reasonable time. It is difficult to
@@ -2348,7 +2354,8 @@ void SelectionDAGBuilder::visitBr(const BranchInst &I) {
23482354

23492355
// If this is not a fall-through branch or optimizations are switched off,
23502356
// emit the branch.
2351-
if (Succ0MBB != NextBlock(BrMBB) || TM.getOptLevel() == CodeGenOpt::None)
2357+
if ((YkNoFallThrough) || (Succ0MBB != NextBlock(BrMBB) ||
2358+
TM.getOptLevel() == CodeGenOpt::None))
23522359
DAG.setRoot(DAG.getNode(ISD::BR, getCurSDLoc(),
23532360
MVT::Other, getControlRoot(),
23542361
DAG.getBasicBlock(Succ0MBB)));

0 commit comments

Comments
 (0)