mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
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:
parent
41a6ddb277
commit
af6721bf06
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user