diff options
author | Aditya Nandakumar <aditya_nandakumar@apple.com> | 2014-07-11 21:49:39 +0000 |
---|---|---|
committer | Aditya Nandakumar <aditya_nandakumar@apple.com> | 2014-07-11 21:49:39 +0000 |
commit | 0b5a674243ae65528f745bba27f08582d609b175 (patch) | |
tree | bad840b8aefd85a1cca9f8b9b251bbb43f482851 /llvm/lib | |
parent | 730abd2f4ad4f9ddff41fc1a49c45ef1a1562bb8 (diff) | |
download | bcm5719-llvm-0b5a674243ae65528f745bba27f08582d609b175.tar.gz bcm5719-llvm-0b5a674243ae65528f745bba27f08582d609b175.zip |
When we sink an instruction, this can open up opportunity for the operands to be sunk - add them to the worklist
llvm-svn: 212847
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 08e24461a61..fe3b8b41fdb 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -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); + } + } } } |