summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-07 07:22:45 +0000
committerChris Lattner <sabre@nondot.org>2008-12-07 07:22:45 +0000
commitf50d7f76c6be0147fec33c2c9fdcce478aa01cfc (patch)
tree05a860faff71264e86d3af8e4cb93275ee6b2dd1
parent12679470bfe700d232d30f28eefc5ecb6f730cce (diff)
downloadbcm5719-llvm-f50d7f76c6be0147fec33c2c9fdcce478aa01cfc.tar.gz
bcm5719-llvm-f50d7f76c6be0147fec33c2c9fdcce478aa01cfc.zip
fix a bug I introduced in simplifycfg handling single entry phi
nodes. FoldSingleEntryPHINodes deletes the PHI, so there is no need to delete it afterward. llvm-svn: 60653
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp1
-rw-r--r--llvm/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll13
2 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index d6465f599cf..e7bd75e0493 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1102,7 +1102,6 @@ static bool FoldCondBranchOnPHI(BranchInst *BI) {
// Degenerate case of a single entry PHI.
if (PN->getNumIncomingValues() == 1) {
FoldSingleEntryPHINodes(PN->getParent());
- PN->eraseFromParent();
return true;
}
diff --git a/llvm/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll b/llvm/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
new file mode 100644
index 00000000000..7b4aee489b5
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis
+define i32 @test() {
+entry:
+ br label %T
+T:
+ %C = phi i1 [false, %entry]
+ br i1 %C, label %X, label %Y
+X:
+ ret i32 2
+Y:
+ add i32 1, 2
+ ret i32 1
+}
OpenPOWER on IntegriCloud