[llvm-commits] [llvm] r60653 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
Chris Lattner
sabre at nondot.org
Sat Dec 6 23:22:45 PST 2008
Author: lattner
Date: Sun Dec 7 01:22:45 2008
New Revision: 60653
URL: http://llvm.org/viewvc/llvm-project?rev=60653&view=rev
Log:
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.
Added:
llvm/trunk/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=60653&r1=60652&r2=60653&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Sun Dec 7 01:22:45 2008
@@ -1102,7 +1102,6 @@
// Degenerate case of a single entry PHI.
if (PN->getNumIncomingValues() == 1) {
FoldSingleEntryPHINodes(PN->getParent());
- PN->eraseFromParent();
return true;
}
Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll?rev=60653&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll (added)
+++ llvm/trunk/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll Sun Dec 7 01:22:45 2008
@@ -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
+}
More information about the llvm-commits
mailing list