summaryrefslogtreecommitdiff
path: root/test/CodeGen/WinEH/wineh-demotion.ll
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-12-15 21:27:27 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-12-15 21:27:27 +0000
commitb46bb541f5f78520b08c1b50463c3517041d26de (patch)
tree7077970a130a6bddebc6d69ac52c208d020dac95 /test/CodeGen/WinEH/wineh-demotion.ll
parent0c7a64a0370b8f6adb4b35ad0a9a3ff3da8f6e97 (diff)
[WinEH] Use operand bundles to describe call sites
SimplifyCFG allows tail merging with code which terminates in unreachable which, in turn, makes it possible for an invoke to end up in a funclet which it was not originally part of. Using operand bundles on invokes allows us to determine whether or not an invoke was part of a funclet in the source program. Furthermore, it allows us to unambiguously answer questions about the legality of inlining into call sites which the personality may have trouble with. Differential Revision: http://reviews.llvm.org/D15517 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/WinEH/wineh-demotion.ll')
-rw-r--r--test/CodeGen/WinEH/wineh-demotion.ll34
1 files changed, 18 insertions, 16 deletions
diff --git a/test/CodeGen/WinEH/wineh-demotion.ll b/test/CodeGen/WinEH/wineh-demotion.ll
index bd239133ea8..411952d84bb 100644
--- a/test/CodeGen/WinEH/wineh-demotion.ll
+++ b/test/CodeGen/WinEH/wineh-demotion.ll
@@ -10,6 +10,8 @@ declare void @h(i32)
declare i1 @i()
+declare void @llvm.bar() nounwind
+
; CHECK-LABEL: @test1(
define void @test1(i1 %B) personality i32 (...)* @__CxxFrameHandler3 {
entry:
@@ -43,7 +45,7 @@ catch:
; CHECK: catch:
; CHECK: [[Reload:%[^ ]+]] = load i32, i32* [[Slot]]
; CHECK-NEXT: call void @h(i32 [[Reload]])
- call void @h(i32 %phi)
+ call void @h(i32 %phi) [ "funclet"(token %cp) ]
catchret from %cp to label %exit
exit:
@@ -81,10 +83,10 @@ catch.inner:
%cpinner = catchpad within %cs1 []
; Need just one store here because only %y is affected
; CHECK: catch.inner:
- %z = call i32 @g()
+ %z = call i32 @g() [ "funclet"(token %cpinner) ]
; CHECK: store i32 %z
; CHECK-NEXT: invoke void @f
- invoke void @f()
+ invoke void @f() [ "funclet"(token %cpinner) ]
to label %catchret.inner unwind label %merge.outer
catchret.inner:
@@ -106,8 +108,8 @@ catch.outer:
; CHECK-DAG: load i32, i32* [[Slot1]]
; CHECK-DAG: load i32, i32* [[Slot2]]
; CHECK: catchret from [[CatchPad]] to label
- call void @h(i32 %x)
- call void @h(i32 %y)
+ call void @h(i32 %x) [ "funclet"(token %cpouter) ]
+ call void @h(i32 %y) [ "funclet"(token %cpouter) ]
catchret from %cpouter to label %exit
exit:
@@ -166,7 +168,7 @@ catch.outer:
; CHECK: [[Reload:%[^ ]+]] = load i32, i32* [[Slot]]
; CHECK: call void @h(i32 [[Reload]])
%cp2 = catchpad within %cs2 []
- call void @h(i32 %phi.outer)
+ call void @h(i32 %phi.outer) [ "funclet"(token %cp2) ]
catchret from %cp2 to label %exit
exit:
ret void
@@ -197,19 +199,19 @@ cleanup:
; CHECK: [[CleanupReload:%[^ ]+]] = load i32, i32* [[CleanupSlot]]
%phi.cleanup = phi i32 [ 1, %entry ], [ 2, %invoke.cont ]
%cp = cleanuppad within none []
- %b = call i1 @i()
+ %b = call i1 @i() [ "funclet"(token %cp) ]
br i1 %b, label %left, label %right
left:
; CHECK: left:
; CHECK: call void @h(i32 [[CleanupReload]]
- call void @h(i32 %phi.cleanup)
+ call void @h(i32 %phi.cleanup) [ "funclet"(token %cp) ]
br label %merge
right:
; CHECK: right:
; CHECK: call void @h(i32 [[CleanupReload]]
- call void @h(i32 %phi.cleanup)
+ call void @h(i32 %phi.cleanup) [ "funclet"(token %cp) ]
br label %merge
merge:
@@ -239,7 +241,7 @@ catch:
; CHECK: [[CatchReload:%[^ ]+]] = load i32, i32* [[CatchSlot]]
; CHECK: call void @h(i32 [[CatchReload]]
%cp2 = catchpad within %cs1 []
- call void @h(i32 %phi.catch)
+ call void @h(i32 %phi.catch) [ "funclet"(token %cp2) ]
catchret from %cp2 to label %exit
exit:
@@ -265,7 +267,7 @@ cleanup:
; CHECK: cleanup:
; CHECK: call void @h(i32 %x)
%cp2 = cleanuppad within none []
- call void @h(i32 %x)
+ call void @h(i32 %x) [ "funclet"(token %cp2) ]
cleanupret from %cp2 unwind to caller
}
@@ -295,7 +297,7 @@ catch:
; CHECK: catch:
; CHECK-NEXT: %[[CatchPad:[^ ]+]] = catchpad within %cs1 []
%cp = catchpad within %cs1 []
- %b = call i1 @i()
+ %b = call i1 @i() [ "funclet"(token %cp) ]
br i1 %b, label %left, label %right
left:
; Edge from %left to %join needs to be split so that
@@ -312,7 +314,7 @@ right:
; CHECK: right:
; CHECK: %y = call i32 @g()
; CHECK: catchret from %[[CatchPad]] to label %join
- %y = call i32 @g()
+ %y = call i32 @g() [ "funclet"(token %cp) ]
catchret from %cp to label %join
join:
; CHECK: join:
@@ -336,19 +338,19 @@ done:
cleanup1:
; CHECK: [[CleanupPad1:%[^ ]+]] = cleanuppad within none []
- ; CHECK-NEXT: call void @f()
+ ; CHECK-NEXT: call void @llvm.bar()
; CHECK-NEXT: cleanupret from [[CleanupPad1]]
%cp0 = cleanuppad within none []
br label %cleanupexit
cleanup2:
; CHECK: cleanuppad within none []
- ; CHECK-NEXT: call void @f()
+ ; CHECK-NEXT: call void @llvm.bar()
; CHECK-NEXT: unreachable
%cp1 = cleanuppad within none []
br label %cleanupexit
cleanupexit:
- call void @f()
+ call void @llvm.bar()
cleanupret from %cp0 unwind label %cleanup2
}