diff options
author | Chris Lattner <sabre@nondot.org> | 2008-12-07 07:22:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-12-07 07:22:45 +0000 |
commit | a16ead8b10ab63e08c91afb852f29b32188b9afb (patch) | |
tree | ee94e952e0b2e517f3db11a9f4a2503e45daa21a | |
parent | 75c99c5aa86409f09616bfa46e723a0bc18e7e54 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60653 91177308-0d34-0410-b5e6-96231b3b80d8
-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 +} |