[llvm-commits] [llvm] r160325 - in /llvm/trunk: lib/Transforms/Scalar/SimplifyCFGPass.cpp test/Transforms/SimplifyCFG/invoke.ll
Nuno Lopes
nunoplopes at sapo.pt
Mon Jul 16 15:49:40 PDT 2012
Author: nlopes
Date: Mon Jul 16 17:49:40 2012
New Revision: 160325
URL: http://llvm.org/viewvc/llvm-project?rev=160325&view=rev
Log:
fix PR13339 (remove the predecessor from the unwind BB when removing an invoke)
Modified:
llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp
llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll
Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp?rev=160325&r1=160324&r2=160325&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Mon Jul 16 17:49:40 2012
@@ -165,6 +165,7 @@
if (II->use_empty() && II->onlyReadsMemory()) {
// jump to the normal destination branch.
BranchInst::Create(II->getNormalDest(), II);
+ II->getUnwindDest()->removePredecessor(II->getParent());
II->eraseFromParent();
} else
ChangeToCall(II);
Modified: llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll?rev=160325&r1=160324&r2=160325&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll Mon Jul 16 17:49:40 2012
@@ -3,6 +3,7 @@
declare i32 @__gxx_personality_v0(...)
declare void @__cxa_call_unexpected(i8*)
+declare void @purefn() nounwind readnone
declare i32 @read_only() nounwind readonly
declare i32 @nounwind_fn() nounwind
declare i32 @fn()
@@ -115,3 +116,24 @@
tail call void @__cxa_call_unexpected(i8* %phi2) noreturn nounwind
unreachable
}
+
+; CHECK: @f6
+define void @f6() {
+entry:
+ invoke void @purefn()
+ to label %invoke.cont1 unwind label %lpad
+
+invoke.cont1:
+ %foo = invoke i32 @fn()
+ to label %invoke.cont2 unwind label %lpad
+
+invoke.cont2:
+ ret void
+
+lpad:
+; CHECK-NOT: phi
+ %tmp = phi i8* [ null, %invoke.cont1 ], [ null, %entry ]
+ landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ cleanup
+ ret void
+}
More information about the llvm-commits
mailing list