mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
Changes to support PHINode::removeIncoming changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4080 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bb190ac8da
commit
dee430d26e
@ -392,7 +392,7 @@ Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC) {
|
|||||||
BasicBlock *BB = OldPN->getIncomingBlock(0);
|
BasicBlock *BB = OldPN->getIncomingBlock(0);
|
||||||
Value *OldVal = OldPN->getIncomingValue(0);
|
Value *OldVal = OldPN->getIncomingValue(0);
|
||||||
ValueHandle OldValHandle(VMC, OldVal);
|
ValueHandle OldValHandle(VMC, OldVal);
|
||||||
OldPN->removeIncomingValue(BB);
|
OldPN->removeIncomingValue(BB, false);
|
||||||
Value *V = ConvertExpressionToType(OldVal, Ty, VMC);
|
Value *V = ConvertExpressionToType(OldVal, Ty, VMC);
|
||||||
NewPN->addIncoming(V, BB);
|
NewPN->addIncoming(V, BB);
|
||||||
}
|
}
|
||||||
@ -1097,7 +1097,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
|||||||
while (OldPN->getNumOperands()) {
|
while (OldPN->getNumOperands()) {
|
||||||
BasicBlock *BB = OldPN->getIncomingBlock(0);
|
BasicBlock *BB = OldPN->getIncomingBlock(0);
|
||||||
Value *OldVal = OldPN->getIncomingValue(0);
|
Value *OldVal = OldPN->getIncomingValue(0);
|
||||||
OldPN->removeIncomingValue(BB);
|
OldPN->removeIncomingValue(BB, false);
|
||||||
Value *V = ConvertExpressionToType(OldVal, NewTy, VMC);
|
Value *V = ConvertExpressionToType(OldVal, NewTy, VMC);
|
||||||
NewPN->addIncoming(V, BB);
|
NewPN->addIncoming(V, BB);
|
||||||
}
|
}
|
||||||
|
@ -184,16 +184,15 @@ void BasicBlock::removePredecessor(BasicBlock *Pred) {
|
|||||||
while (PHINode *PN = dyn_cast<PHINode>(&front())) {
|
while (PHINode *PN = dyn_cast<PHINode>(&front())) {
|
||||||
PN->removeIncomingValue(Pred); // Remove the predecessor first...
|
PN->removeIncomingValue(Pred); // Remove the predecessor first...
|
||||||
|
|
||||||
assert(PN->getNumIncomingValues() == max_idx-1 &&
|
|
||||||
"PHI node shouldn't have this many values!!!");
|
|
||||||
|
|
||||||
// If the PHI _HAD_ two uses, replace PHI node with its now *single* value
|
// If the PHI _HAD_ two uses, replace PHI node with its now *single* value
|
||||||
if (max_idx == 2)
|
if (max_idx == 2) {
|
||||||
PN->replaceAllUsesWith(PN->getOperand(0));
|
PN->replaceAllUsesWith(PN->getOperand(0));
|
||||||
else // Otherwise there are no incoming values/edges, replace with dummy
|
|
||||||
PN->replaceAllUsesWith(Constant::getNullValue(PN->getType()));
|
|
||||||
getInstList().pop_front(); // Remove the PHI node
|
getInstList().pop_front(); // Remove the PHI node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the PHI node already only had one entry, it got deleted by
|
||||||
|
// removeIncomingValue.
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Okay, now we know that we need to remove predecessor #pred_idx from all
|
// Okay, now we know that we need to remove predecessor #pred_idx from all
|
||||||
// PHI nodes. Iterate over each PHI node fixing them up
|
// PHI nodes. Iterate over each PHI node fixing them up
|
||||||
|
Loading…
Reference in New Issue
Block a user