[llvm-commits] [llvm] r159534 - in /llvm/trunk: lib/Transforms/Scalar/SimplifyCFGPass.cpp test/Transforms/SimplifyCFG/invoke.ll
Nuno Lopes
nunoplopes at sapo.pt
Mon Jul 2 09:14:47 PDT 2012
Author: nlopes
Date: Mon Jul 2 11:14:47 2012
New Revision: 159534
URL: http://llvm.org/viewvc/llvm-project?rev=159534&view=rev
Log:
fix the regression I introduced in r159385 (it's necessary to update PHI nodes in unwind BB
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=159534&r1=159533&r2=159534&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Mon Jul 2 11:14:47 2012
@@ -99,6 +99,9 @@
// Follow the call by a branch to the normal destination.
BranchInst::Create(II->getNormalDest(), II);
+
+ // Update PHI nodes in the unwind destination
+ II->getUnwindDest()->removePredecessor(II->getParent());
II->eraseFromParent();
}
Modified: llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll?rev=159534&r1=159533&r2=159534&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/invoke.ll Mon Jul 2 11:14:47 2012
@@ -4,6 +4,8 @@
declare i32 @__gxx_personality_v0(...)
declare void @__cxa_call_unexpected(i8*)
declare i32 @read_only() nounwind readonly
+declare i32 @nounwind_fn() nounwind
+declare i32 @fn()
; CHECK: @f1
@@ -82,3 +84,34 @@
tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind
unreachable
}
+
+; CHECK: @f5
+define i32 @f5(i1 %cond, i8* %a, i8* %b) {
+entry:
+ br i1 %cond, label %x, label %y
+
+x:
+; CHECK: invoke i32 @fn()
+ %call = invoke i32 @fn()
+ to label %cont unwind label %lpad
+
+y:
+; CHECK: call i32 @nounwind_fn()
+ %call2 = invoke i32 @nounwind_fn()
+ to label %cont unwind label %lpad
+
+cont:
+; CHECK: phi i32
+; CHECK: ret i32 %phi
+ %phi = phi i32 [%call, %x], [%call2, %y]
+ ret i32 %phi
+
+lpad:
+; CHECK-NOT: phi
+ %phi2 = phi i8* [%a, %x], [%b, %y]
+ %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ filter [0 x i8*] zeroinitializer
+; CHECK: __cxa_call_unexpected(i8* %a)
+ tail call void @__cxa_call_unexpected(i8* %phi2) noreturn nounwind
+ unreachable
+}
More information about the llvm-commits
mailing list