diff options
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 1 | ||||
-rw-r--r-- | test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index d6465f599c..e7bd75e049 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/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/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll b/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll new file mode 100644 index 0000000000..7b4aee489b --- /dev/null +++ b/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 +} |