summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-06-01 02:17:11 +0000
committerJohn McCall <rjmccall@apple.com>2011-06-01 02:17:11 +0000
commit1edbd6f3f07176851cb03f7932ff50b9e9619dfb (patch)
tree148a40729298608a35dfc17fea9f40ef397e3c9e /test/Transforms
parentedac4923dc2e1694f7004123ccd7c1af952d0d68 (diff)
downloadllvm-1edbd6f3f07176851cb03f7932ff50b9e9619dfb.tar.gz
llvm-1edbd6f3f07176851cb03f7932ff50b9e9619dfb.tar.bz2
llvm-1edbd6f3f07176851cb03f7932ff50b9e9619dfb.tar.xz
First, do no harm -- even if we can't find a selector for an enclosing
landing pad, forward llvm.eh.resume calls to it instead of turning them invalidly into invokes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/Inline/inline_invoke.ll31
1 files changed, 29 insertions, 2 deletions
diff --git a/test/Transforms/Inline/inline_invoke.ll b/test/Transforms/Inline/inline_invoke.ll
index 110a82823e..5f657387c2 100644
--- a/test/Transforms/Inline/inline_invoke.ll
+++ b/test/Transforms/Inline/inline_invoke.ll
@@ -4,7 +4,7 @@
; by appending selectors and forwarding _Unwind_Resume directly to the
; enclosing landing pad.
-;; Test 1 - basic functionality.
+;; Test 0 - basic functionality.
%struct.A = type { i8 }
@@ -112,7 +112,7 @@ eh.resume:
; CHECK-NEXT: call i32 @llvm.eh.typeid.for(
-;; Test 2 - Correctly handle phis in outer landing pads.
+;; Test 1 - Correctly handle phis in outer landing pads.
define void @test1_out() uwtable ssp {
entry:
@@ -216,3 +216,30 @@ eh.resume:
; CHECK: call void @use(i32 [[YJ1]])
; CHECK: call void @llvm.eh.resume(i8* [[EXNJ1]], i32 [[SELJ1]])
+
+;; Test 2 - Don't make invalid IR for inlines into landing pads without eh.exception calls
+
+define void @test2_out() uwtable ssp {
+entry:
+ invoke void @test0_in()
+ to label %ret unwind label %lpad
+
+ret:
+ ret void
+
+lpad:
+ call void @_ZSt9terminatev()
+ unreachable
+}
+
+; CHECK: define void @test2_out()
+; CHECK: [[A:%.*]] = alloca %struct.A,
+; CHECK: [[B:%.*]] = alloca %struct.A,
+; CHECK: invoke void @_ZN1AC1Ev(%struct.A* [[A]])
+; CHECK-NEXT: unwind label %[[LPAD:[^\s]+]]
+; CHECK: invoke void @_ZN1AC1Ev(%struct.A* [[B]])
+; CHECK-NEXT: unwind label %[[LPAD2:[^\s]+]]
+; CHECK: invoke void @_ZN1AD1Ev(%struct.A* [[B]])
+; CHECK-NEXT: unwind label %[[LPAD2]]
+; CHECK: invoke void @_ZN1AD1Ev(%struct.A* [[A]])
+; CHECK-NEXT: unwind label %[[LPAD]]