summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-04-25 00:37:04 +0000
committerDevang Patel <dpatel@apple.com>2007-04-25 00:37:04 +0000
commitd3208523b24e22954eee3fc4b0f522519f0345a6 (patch)
tree5c52b7677bf97590c1ccc270c653681397ea34ee /llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
parent206baa44256e1e69c53c3a30ed00f1c77467b440 (diff)
downloadbcm5719-llvm-d3208523b24e22954eee3fc4b0f522519f0345a6.tar.gz
bcm5719-llvm-d3208523b24e22954eee3fc4b0f522519f0345a6.zip
Fix
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048376.html llvm-svn: 36417
Diffstat (limited to 'llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 8c321f4719b..7a3eac78c56 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -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;
+ }
+ }
}
}
OpenPOWER on IntegriCloud