mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-11 13:46:13 +00:00
Don't try to create PHIs of struct types. Fallout
from x86-64 calling convention work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50545 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e85b7585e9
commit
796026711d
@ -249,14 +249,37 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
|
|||||||
// create new PHINode for this instruction.
|
// create new PHINode for this instruction.
|
||||||
Instruction *NewHeaderReplacement = NULL;
|
Instruction *NewHeaderReplacement = NULL;
|
||||||
if (usedOutsideOriginalHeader(In)) {
|
if (usedOutsideOriginalHeader(In)) {
|
||||||
PHINode *PN = PHINode::Create(In->getType(), In->getName());
|
const StructType *STy = dyn_cast<StructType>(In->getType());
|
||||||
PN->addIncoming(In, OrigHeader);
|
if (STy) {
|
||||||
PN->addIncoming(C, OrigPreHeader);
|
// Can't create PHI nodes for this type. If there are any getResults
|
||||||
NewHeader->getInstList().push_front(PN);
|
// not defined in this block, move them back to this block. PHI
|
||||||
NewHeaderReplacement = PN;
|
// nodes will be created for all getResults later.
|
||||||
}
|
BasicBlock::iterator InsertPoint;
|
||||||
|
if (InvokeInst *II = dyn_cast<InvokeInst>(In)) {
|
||||||
// "In" can be replaced by NPH or NH at various places.
|
InsertPoint = II->getNormalDest()->begin();
|
||||||
|
while (isa<PHINode>(InsertPoint))
|
||||||
|
++InsertPoint;
|
||||||
|
} else {
|
||||||
|
InsertPoint = I; // call
|
||||||
|
InsertPoint++;
|
||||||
|
}
|
||||||
|
for (Value::use_iterator UI = In->use_begin(), UE = In->use_end();
|
||||||
|
UI != UE; ++UI) {
|
||||||
|
GetResultInst *InGR = cast<GetResultInst>(UI);
|
||||||
|
if (InGR->getParent() != OrigHeader) {
|
||||||
|
// move InGR to immediately follow call. It will be picked
|
||||||
|
// up, cloned and PHI'd on the next iteration.
|
||||||
|
InGR->moveBefore(InsertPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PHINode *PN = PHINode::Create(In->getType(), In->getName());
|
||||||
|
PN->addIncoming(In, OrigHeader);
|
||||||
|
PN->addIncoming(C, OrigPreHeader);
|
||||||
|
NewHeader->getInstList().push_front(PN);
|
||||||
|
NewHeaderReplacement = PN;
|
||||||
|
}
|
||||||
|
}
|
||||||
LoopHeaderInfo.push_back(RenameData(In, C, NewHeaderReplacement));
|
LoopHeaderInfo.push_back(RenameData(In, C, NewHeaderReplacement));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user