mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-24 06:27:56 +00:00
instructions defined in CurBB may be intermediate nodes of the computation.
llvm-svn: 90908
This commit is contained in:
parent
83cb0b1450
commit
b0d20540ad
@ -83,9 +83,9 @@ public:
|
|||||||
|
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
/// Verify - Check internal consistency of this data structure. Though it
|
/// Verify - Check internal consistency of this data structure. If the
|
||||||
/// claims to return a bool, it actually aborts on error and always returns
|
/// structure is valid, it returns true. If invalid, it prints errors and
|
||||||
/// true.
|
/// returns false.
|
||||||
bool Verify() const;
|
bool Verify() const;
|
||||||
private:
|
private:
|
||||||
Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB);
|
Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB);
|
||||||
|
@ -154,12 +154,20 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
|
|||||||
Instruction *Inst = dyn_cast<Instruction>(V);
|
Instruction *Inst = dyn_cast<Instruction>(V);
|
||||||
if (Inst == 0) return V;
|
if (Inst == 0) return V;
|
||||||
|
|
||||||
// If 'Inst' is defined in this block, it must be an input that needs to be
|
// Determine whether 'Inst' is an input to our PHI translatable expression.
|
||||||
// phi translated or an intermediate expression that needs to be incorporated
|
bool isInput = std::count(InstInputs.begin(), InstInputs.end(), Inst);
|
||||||
// into the expression.
|
|
||||||
if (Inst->getParent() == CurBB) {
|
// Handle inputs instructions if needed.
|
||||||
assert(std::count(InstInputs.begin(), InstInputs.end(), Inst) &&
|
if (isInput) {
|
||||||
"Not an input?");
|
if (Inst->getParent() != CurBB) {
|
||||||
|
// If it is an input defined in a different block, then it remains an
|
||||||
|
// input.
|
||||||
|
return Inst;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If 'Inst' is defined in this block, it must be an input that needs to be
|
||||||
|
// phi translated or an intermediate expression that needs to be incorporated
|
||||||
|
// 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))
|
||||||
@ -179,14 +187,6 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
|
|||||||
for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i)
|
for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i)
|
||||||
if (Instruction *Op = dyn_cast<Instruction>(Inst->getOperand(i)))
|
if (Instruction *Op = dyn_cast<Instruction>(Inst->getOperand(i)))
|
||||||
InstInputs.push_back(Op);
|
InstInputs.push_back(Op);
|
||||||
|
|
||||||
} else {
|
|
||||||
// Determine whether 'Inst' is an input to our PHI translatable expression.
|
|
||||||
bool isInput = std::count(InstInputs.begin(), InstInputs.end(), Inst);
|
|
||||||
|
|
||||||
// If it is an input defined in a different block, then it remains an input.
|
|
||||||
if (isInput)
|
|
||||||
return Inst;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ok, it must be an intermediate result (either because it started that way
|
// Ok, it must be an intermediate result (either because it started that way
|
||||||
|
Loading…
x
Reference in New Issue
Block a user