[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Sep 19 16:57:16 PDT 2005



Changes in directory llvm/lib/Transforms/Utils:

SimplifyCFG.cpp updated: 1.84 -> 1.85
---
Log message:

Reject a case we don't handle yet


---
Diffs of the changes:  (+3 -1)

 SimplifyCFG.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.84 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.85
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.84	Mon Sep 19 18:50:15 2005
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp	Mon Sep 19 18:57:04 2005
@@ -897,7 +897,9 @@
 static bool FoldCondBranchOnPHI(BranchInst *BI) {
   BasicBlock *BB = BI->getParent();
   PHINode *PN = dyn_cast<PHINode>(BI->getCondition());
-  if (!PN || PN->getParent() != BB) return false;
+  // NOTE: we currently cannot transform this case if the PHI node is used
+  // outside of the block.
+  if (!PN || PN->getParent() != BB || !PN->hasOneUse()) return false;
   
   // Degenerate case of a single entry PHI.
   if (PN->getNumIncomingValues() == 1) {






More information about the llvm-commits mailing list