mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Fix LICM/2003-12-11-SinkingToPHI.ll, and quite possibly all of the other known problems in the universe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10409 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0ac4d9247b
commit
ea9403f2aa
@ -337,9 +337,18 @@ bool LICM::canSinkOrHoistInst(Instruction &I) {
|
||||
/// exit blocks of the loop.
|
||||
///
|
||||
bool LICM::isNotUsedInLoop(Instruction &I) {
|
||||
for (Value::use_iterator UI = I.use_begin(), E = I.use_end(); UI != E; ++UI)
|
||||
if (CurLoop->contains(cast<Instruction>(*UI)->getParent()))
|
||||
for (Value::use_iterator UI = I.use_begin(), E = I.use_end(); UI != E; ++UI) {
|
||||
Instruction *User = cast<Instruction>(*UI);
|
||||
if (PHINode *PN = dyn_cast<PHINode>(User)) {
|
||||
// PHI node uses occur in predecessor blocks!
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
||||
if (PN->getIncomingValue(i) == &I)
|
||||
if (CurLoop->contains(PN->getIncomingBlock(i)))
|
||||
return false;
|
||||
} else if (CurLoop->contains(User->getParent())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user