Skip to content

Commit

Permalink
Merge rust-lang#29
Browse files Browse the repository at this point in the history
29: In SelectionDAG lowering, always emit a branch. r=ptersilie a=vext01



Co-authored-by: Edd Barrett <vext01@gmail.com>
  • Loading branch information
bors[bot] and vext01 authored Mar 30, 2022
2 parents 4c38c71 + 9ec5475 commit c697a93
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ static cl::opt<unsigned> SwitchPeelThreshold(
"switch statement. A value greater than 100 will void this "
"optimization"));

static cl::opt<bool> YkNoFallThrough(
"yk-no-fallthrough", cl::Hidden, cl::init(false),
cl::desc("Always emit a branch even if fallthrough is possible. This "
"is required for the yk JIT, so that the machine IR has the "
"same block structure as the high-level IR"));

// Limit the width of DAG chains. This is important in general to prevent
// DAG-based analysis from blowing up. For example, alias analysis and
// load clustering may not complete in reasonable time. It is difficult to
Expand Down Expand Up @@ -2348,7 +2354,8 @@ void SelectionDAGBuilder::visitBr(const BranchInst &I) {

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

0 comments on commit c697a93

Please sign in to comment.