forked from OSchip/llvm-project
Fix future bug. Of course, Chris spotted this.
Handle Argument or Undef as an incoming PHI value. llvm-svn: 35821
This commit is contained in:
parent
b28a391a8d
commit
d6ba41e02d
|
@ -369,7 +369,6 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Make sure all Exit block PHINodes have required incoming values.
|
/// Make sure all Exit block PHINodes have required incoming values.
|
||||||
/// If incoming value is constant or defined outside the loop then
|
/// If incoming value is constant or defined outside the loop then
|
||||||
/// PHINode may not have an entry for new pre-header.
|
/// PHINode may not have an entry for new pre-header.
|
||||||
|
@ -382,20 +381,22 @@ void LoopRotate::updateExitBlock() {
|
||||||
if (!PN)
|
if (!PN)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (PN->getBasicBlockIndex(NewPreHeader) == -1) {
|
// There is already one incoming value from new pre-header block.
|
||||||
Value *V = PN->getIncomingValueForBlock(OrigHeader);
|
if (PN->getBasicBlockIndex(NewPreHeader) != -1)
|
||||||
if (isa<Constant>(V))
|
return;
|
||||||
PN->addIncoming(V, NewPreHeader);
|
|
||||||
else {
|
RenameData *ILoopHeaderInfo;
|
||||||
RenameData *ILoopHeaderInfo = findReplacementData(cast<Instruction>(V));
|
Value *V = PN->getIncomingValueForBlock(OrigHeader);
|
||||||
assert (ILoopHeaderInfo && ILoopHeaderInfo->PreHeader && "Missing New Preheader Instruction");
|
if (isa<Instruction>(V) &&
|
||||||
PN->addIncoming(ILoopHeaderInfo->PreHeader, NewPreHeader);
|
(ILoopHeaderInfo = findReplacementData(cast<Instruction>(V)))) {
|
||||||
}
|
assert (ILoopHeaderInfo->PreHeader && "Missing New Preheader Instruction");
|
||||||
|
PN->addIncoming(ILoopHeaderInfo->PreHeader, NewPreHeader);
|
||||||
|
} else {
|
||||||
|
PN->addIncoming(V, NewPreHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Initialize local data
|
/// Initialize local data
|
||||||
void LoopRotate::initialize() {
|
void LoopRotate::initialize() {
|
||||||
L = NULL;
|
L = NULL;
|
||||||
|
|
Loading…
Reference in New Issue