mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
fix PHI translation to take the PHI out of the instinputs set and add
the translated value back to it if an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90909 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
af50315a29
commit
e09e98c2de
@ -165,21 +165,19 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
|
|||||||
return Inst;
|
return Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If 'Inst' is defined in this block, it must be an input that needs to be
|
// If 'Inst' is defined in this block and is an input that needs to be phi
|
||||||
// phi translated or an intermediate expression that needs to be incorporated
|
// translated, we need to incorporate the value into the expression or fail.
|
||||||
// into the expression.
|
|
||||||
|
|
||||||
// If this is a PHI, go ahead and translate it.
|
// If this is a PHI, go ahead and translate it.
|
||||||
if (PHINode *PN = dyn_cast<PHINode>(Inst))
|
if (PHINode *PN = dyn_cast<PHINode>(Inst))
|
||||||
return PN->getIncomingValueForBlock(PredBB);
|
return ReplaceInstWithValue(PN, PN->getIncomingValueForBlock(PredBB));
|
||||||
|
|
||||||
|
|
||||||
// If this is a non-phi value, and it is analyzable, we can incorporate it
|
// If this is a non-phi value, and it is analyzable, we can incorporate it
|
||||||
// into the expression by making all instruction operands be inputs.
|
// into the expression by making all instruction operands be inputs.
|
||||||
if (!CanPHITrans(Inst))
|
if (!CanPHITrans(Inst))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Okay, we can incorporate it, this instruction is no longer an input.
|
// The instruction itself isn't an input any longer.
|
||||||
InstInputs.erase(std::find(InstInputs.begin(), InstInputs.end(), Inst));
|
InstInputs.erase(std::find(InstInputs.begin(), InstInputs.end(), Inst));
|
||||||
|
|
||||||
// All instruction operands are now inputs (and of course, they may also be
|
// All instruction operands are now inputs (and of course, they may also be
|
||||||
|
Loading…
x
Reference in New Issue
Block a user