When we sink an instruction, this can open up opportunity for the operands to be sunk - add them to the worklist

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212847 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Aditya Nandakumar 2014-07-11 21:49:39 +00:00
parent 41a6ddb277
commit af6721bf06
2 changed files with 12 additions and 3 deletions

View File

@ -2730,9 +2730,18 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
// If the user is one of our immediate successors, and if that successor
// only has us as a predecessors (we'd have to split the critical edge
// otherwise), we can keep going.
if (UserIsSuccessor && UserParent->getSinglePredecessor())
if (UserIsSuccessor && UserParent->getSinglePredecessor()) {
// Okay, the CFG is simple enough, try to sink this instruction.
MadeIRChange |= TryToSinkInstruction(I, UserParent);
if (TryToSinkInstruction(I, UserParent)) {
MadeIRChange = true;
// We'll add uses of the sunk instruction below, but since sinking
// can expose opportunities for it's *operands* add them to the
// worklist
for (Use &U : I->operands())
if (Instruction *OpI = dyn_cast<Instruction>(U.get()))
Worklist.Add(OpI);
}
}
}
}

View File

@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0"
;CHECK: br
;CHECK: br
;CHECK: getelementptr
;CHECK-NEXT: getelementptr
;CHECK-DAG: getelementptr
;CHECK-DAG: icmp uge
;CHECK-DAG: icmp uge
;CHECK-DAG: icmp uge