mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
Fix
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048376.html git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36417 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
193b585f1b
commit
75abc1ed06
@ -129,6 +129,18 @@ bool CodeGenPrepare::CanMergeBlocks(const BasicBlock *BB,
|
||||
const Instruction *User = cast<Instruction>(*UI);
|
||||
if (User->getParent() != DestBB || !isa<PHINode>(User))
|
||||
return false;
|
||||
// If User is inside DestBB block and it is a PHINode then check
|
||||
// incoming value. If incoming value is not from BB then this is
|
||||
// a complex condition (e.g. preheaders) we want to avoid here.
|
||||
if (User->getParent() == DestBB) {
|
||||
if (const PHINode *UPN = dyn_cast<PHINode>(User))
|
||||
for (unsigned I = 0, E = UPN->getNumIncomingValues(); I != E; ++I) {
|
||||
Instruction *Insn = dyn_cast<Instruction>(UPN->getIncomingValue(I));
|
||||
if (Insn && Insn->getParent() == BB &&
|
||||
Insn->getParent() != UPN->getIncomingBlock(I))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user