summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-19 23:57:04 +0000
committerChris Lattner <sabre@nondot.org>2005-09-19 23:57:04 +0000
commit9c88d9816246d260b37cdc689f313c56aec6941e (patch)
tree82e47390c0d1eaa42b7748146db66ed0b9b30b90
parent7e1ff8d2d923ad62a2776aac35fb88a26a7e83d3 (diff)
downloadexternal_llvm-9c88d9816246d260b37cdc689f313c56aec6941e.zip
external_llvm-9c88d9816246d260b37cdc689f313c56aec6941e.tar.gz
external_llvm-9c88d9816246d260b37cdc689f313c56aec6941e.tar.bz2
Reject a case we don't handle yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23393 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 08403ae..c0cb2f4 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -897,7 +897,9 @@ HoistTerminator:
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) {