[llvm-commits] CVS: llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
Devang Patel
dpatel at apple.com
Tue Apr 24 17:37:23 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
CodeGenPrepare.cpp updated: 1.5 -> 1.6
---
Log message:
Fix
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048376.html
---
Diffs of the changes: (+12 -0)
CodeGenPrepare.cpp | 12 ++++++++++++
1 files changed, 12 insertions(+)
Index: llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
diff -u llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.5 llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.6
--- llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.5 Fri Apr 13 19:17:39 2007
+++ llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp Tue Apr 24 19:37:04 2007
@@ -129,6 +129,18 @@
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;
+ }
+ }
}
}
More information about the llvm-commits
mailing list