aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/SimplifyCFG
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/SimplifyCFG')
-rw-r--r--test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll4
-rw-r--r--test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll4
-rw-r--r--test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll4
-rw-r--r--test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll4
-rw-r--r--test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll4
-rw-r--r--test/Transforms/SimplifyCFG/AMDGPU/cttz-ctlz.ll (renamed from test/Transforms/SimplifyCFG/R600/cttz-ctlz.ll)0
-rw-r--r--test/Transforms/SimplifyCFG/AMDGPU/lit.local.cfg2
-rw-r--r--test/Transforms/SimplifyCFG/R600/lit.local.cfg2
-rw-r--r--test/Transforms/SimplifyCFG/UnreachableEliminate.ll4
-rw-r--r--test/Transforms/SimplifyCFG/duplicate-landingpad.ll20
-rw-r--r--test/Transforms/SimplifyCFG/invoke.ll24
-rw-r--r--test/Transforms/SimplifyCFG/invoke_unwind.ll4
-rw-r--r--test/Transforms/SimplifyCFG/seh-nounwind.ll4
-rw-r--r--test/Transforms/SimplifyCFG/statepoint-invoke-unwind.ll24
14 files changed, 64 insertions, 40 deletions
diff --git a/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll b/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll
index 7551e8fb747c..fe3a603a0426 100644
--- a/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll
+++ b/test/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll
@@ -2,13 +2,13 @@
;
; RUN: opt < %s -simplifycfg -disable-output
-define i32 @test() {
+define i32 @test() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
%A = invoke i32 @test( )
to label %Ret unwind label %Ret2 ; <i32> [#uses=1]
Ret: ; preds = %0
ret i32 %A
Ret2: ; preds = %0
- %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ %val = landingpad { i8*, i32 }
catch i8* null
ret i32 undef
}
diff --git a/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll b/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll
index 2ecdc95259cc..c71f05bf0a35 100644
--- a/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll
+++ b/test/Transforms/SimplifyCFG/2005-10-02-InvokeSimplify.ll
@@ -1,10 +1,10 @@
; RUN: opt < %s -simplifycfg -disable-output
-define i1 @foo() {
+define i1 @foo() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
%X = invoke i1 @foo( )
to label %N unwind label %F ; <i1> [#uses=1]
F: ; preds = %0
- %val = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ %val = landingpad { i8*, i32 }
catch i8* null
ret i1 false
N: ; preds = %0
diff --git a/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll b/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll
index 76f41e8fc218..c38d71ccd284 100644
--- a/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll
+++ b/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll
@@ -4,7 +4,7 @@
declare i32 @func(i8*) nounwind
-define i32 @test() {
+define i32 @test() personality i32 (...)* @__gxx_personality_v0 {
invoke i32 @func( i8* null )
to label %Cont unwind label %Other ; <i32>:1 [#uses=0]
@@ -12,7 +12,7 @@ Cont: ; preds = %0
ret i32 0
Other: ; preds = %0
- landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
+ landingpad { i8*, i32 }
catch i8* null
ret i32 1
}
diff --git a/test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll b/test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll
index 333336de7673..d545739bc745 100644
--- a/test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll
+++ b/test/Transforms/SimplifyCFG/2010-03-30-InvokeCrash.ll
@@ -5,7 +5,7 @@ target triple = "x86_64-unknown-linux-gnu"
declare void @bar(i32)
-define void @foo() {
+define void @foo() personality i32 (...)* @__gxx_personality_v0 {
entry:
invoke void @bar(i32 undef)
to label %r unwind label %u
@@ -14,7 +14,7 @@ r: ; preds = %entry
ret void
u: ; preds = %entry
- %val = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
+ %val = landingpad { i8*, i32 }
cleanup
resume { i8*, i32 } %val
}
diff --git a/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll b/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll
index 7558419a2ebd..111434b7fcdb 100644
--- a/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll
+++ b/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll
@@ -5,7 +5,7 @@
declare void @bar()
-define i32 @foo() {
+define i32 @foo() personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 {
entry:
invoke void @bar()
to label %return unwind label %lpad
@@ -14,7 +14,7 @@ return:
ret i32 0
lpad:
- %lp = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0
+ %lp = landingpad { i8*, i32 }
cleanup
resume { i8*, i32 } %lp
}
diff --git a/test/Transforms/SimplifyCFG/R600/cttz-ctlz.ll b/test/Transforms/SimplifyCFG/AMDGPU/cttz-ctlz.ll
index 5b2799494647..5b2799494647 100644
--- a/test/Transforms/SimplifyCFG/R600/cttz-ctlz.ll
+++ b/test/Transforms/SimplifyCFG/AMDGPU/cttz-ctlz.ll
diff --git a/test/Transforms/SimplifyCFG/AMDGPU/lit.local.cfg b/test/Transforms/SimplifyCFG/AMDGPU/lit.local.cfg
new file mode 100644
index 000000000000..2a665f06be72
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/AMDGPU/lit.local.cfg
@@ -0,0 +1,2 @@
+if not 'AMDGPU' in config.root.targets:
+ config.unsupported = True
diff --git a/test/Transforms/SimplifyCFG/R600/lit.local.cfg b/test/Transforms/SimplifyCFG/R600/lit.local.cfg
deleted file mode 100644
index ad9ce2541ef7..000000000000
--- a/test/Transforms/SimplifyCFG/R600/lit.local.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-if not 'R600' in config.root.targets:
- config.unsupported = True
diff --git a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
index 8718c552c693..87872a6a8a10 100644
--- a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
+++ b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
@@ -13,7 +13,7 @@ F:
ret void
}
-define void @test2() {
+define void @test2() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @test2(
; CHECK: entry:
; CHECK-NEXT: call void @test2()
@@ -22,7 +22,7 @@ entry:
invoke void @test2( )
to label %N unwind label %U
U:
- %res = landingpad { i8* } personality i32 (...)* @__gxx_personality_v0
+ %res = landingpad { i8* }
cleanup
unreachable
N:
diff --git a/test/Transforms/SimplifyCFG/duplicate-landingpad.ll b/test/Transforms/SimplifyCFG/duplicate-landingpad.ll
index 54028774d20e..93c55f0064cc 100644
--- a/test/Transforms/SimplifyCFG/duplicate-landingpad.ll
+++ b/test/Transforms/SimplifyCFG/duplicate-landingpad.ll
@@ -6,7 +6,7 @@ declare void @fn()
; CHECK-LABEL: @test1
-define void @test1() {
+define void @test1() personality i32 (...)* @__gxx_personality_v0 {
entry:
; CHECK-LABEL: entry:
; CHECK: to label %invoke2 unwind label %lpad2
@@ -23,17 +23,17 @@ invoke.cont:
ret void
lpad1:
- %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ %exn = landingpad {i8*, i32}
cleanup
br label %shared_resume
lpad2:
; CHECK-LABEL: lpad2:
-; CHECK: landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
+; CHECK: landingpad { i8*, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: call void @fn()
; CHECK-NEXT: ret void
- %exn2 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ %exn2 = landingpad {i8*, i32}
cleanup
br label %shared_resume
@@ -43,7 +43,7 @@ shared_resume:
}
; Don't trigger if blocks aren't the same/empty
-define void @neg1() {
+define void @neg1() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @neg1
entry:
; CHECK-LABEL: entry:
@@ -61,13 +61,13 @@ invoke.cont:
ret void
lpad1:
- %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ %exn = landingpad {i8*, i32}
filter [0 x i8*] zeroinitializer
call void @fn()
br label %shared_resume
lpad2:
- %exn2 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ %exn2 = landingpad {i8*, i32}
cleanup
br label %shared_resume
@@ -77,7 +77,7 @@ shared_resume:
}
; Should not trigger when the landing pads are not the exact same
-define void @neg2() {
+define void @neg2() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @neg2
entry:
; CHECK-LABEL: entry:
@@ -95,12 +95,12 @@ invoke.cont:
ret void
lpad1:
- %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ %exn = landingpad {i8*, i32}
filter [0 x i8*] zeroinitializer
br label %shared_resume
lpad2:
- %exn2 = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ %exn2 = landingpad {i8*, i32}
cleanup
br label %shared_resume
diff --git a/test/Transforms/SimplifyCFG/invoke.ll b/test/Transforms/SimplifyCFG/invoke.ll
index 5f513ac3e6de..b7fd7d62ccf0 100644
--- a/test/Transforms/SimplifyCFG/invoke.ll
+++ b/test/Transforms/SimplifyCFG/invoke.ll
@@ -10,7 +10,7 @@ declare i32 @fn()
; CHECK-LABEL: @f1(
-define i8* @f1() nounwind uwtable ssp {
+define i8* @f1() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
; CHECK: call void @llvm.trap()
; CHECK: unreachable
@@ -21,7 +21,7 @@ invoke.cont:
ret i8* %call
lpad:
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ %0 = landingpad { i8*, i32 }
filter [0 x i8*] zeroinitializer
%1 = extractvalue { i8*, i32 } %0, 0
tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind
@@ -29,7 +29,7 @@ lpad:
}
; CHECK-LABEL: @f2(
-define i8* @f2() nounwind uwtable ssp {
+define i8* @f2() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
; CHECK: call void @llvm.trap()
; CHECK: unreachable
@@ -40,7 +40,7 @@ invoke.cont:
ret i8* %call
lpad:
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ %0 = landingpad { i8*, i32 }
filter [0 x i8*] zeroinitializer
%1 = extractvalue { i8*, i32 } %0, 0
tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind
@@ -48,7 +48,7 @@ lpad:
}
; CHECK-LABEL: @f3(
-define i32 @f3() nounwind uwtable ssp {
+define i32 @f3() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
; CHECK-NEXT: entry
entry:
; CHECK-NEXT: ret i32 3
@@ -59,7 +59,7 @@ invoke.cont:
ret i32 3
lpad:
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ %0 = landingpad { i8*, i32 }
filter [0 x i8*] zeroinitializer
%1 = extractvalue { i8*, i32 } %0, 0
tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind
@@ -67,7 +67,7 @@ lpad:
}
; CHECK-LABEL: @f4(
-define i32 @f4() nounwind uwtable ssp {
+define i32 @f4() nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
; CHECK-NEXT: entry
entry:
; CHECK-NEXT: call i32 @read_only()
@@ -79,7 +79,7 @@ invoke.cont:
ret i32 %call
lpad:
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ %0 = landingpad { i8*, i32 }
filter [0 x i8*] zeroinitializer
%1 = extractvalue { i8*, i32 } %0, 0
tail call void @__cxa_call_unexpected(i8* %1) noreturn nounwind
@@ -87,7 +87,7 @@ lpad:
}
; CHECK-LABEL: @f5(
-define i32 @f5(i1 %cond, i8* %a, i8* %b) {
+define i32 @f5(i1 %cond, i8* %a, i8* %b) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
br i1 %cond, label %x, label %y
@@ -110,7 +110,7 @@ cont:
lpad:
; CHECK-NOT: phi
%phi2 = phi i8* [%a, %x], [%b, %y]
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ %0 = landingpad { i8*, i32 }
filter [0 x i8*] zeroinitializer
; CHECK: __cxa_call_unexpected(i8* %a)
tail call void @__cxa_call_unexpected(i8* %phi2) noreturn nounwind
@@ -118,7 +118,7 @@ lpad:
}
; CHECK-LABEL: @f6(
-define void @f6() {
+define void @f6() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
invoke void @purefn()
to label %invoke.cont1 unwind label %lpad
@@ -133,7 +133,7 @@ invoke.cont2:
lpad:
; CHECK-NOT: phi
%tmp = phi i8* [ null, %invoke.cont1 ], [ null, %entry ]
- landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ landingpad { i8*, i32 }
cleanup
ret void
}
diff --git a/test/Transforms/SimplifyCFG/invoke_unwind.ll b/test/Transforms/SimplifyCFG/invoke_unwind.ll
index 435bed0c2957..3b4c09d96f77 100644
--- a/test/Transforms/SimplifyCFG/invoke_unwind.ll
+++ b/test/Transforms/SimplifyCFG/invoke_unwind.ll
@@ -4,7 +4,7 @@ declare void @bar()
; This testcase checks to see if the simplifycfg pass is converting invoke
; instructions to call instructions if the handler just rethrows the exception.
-define i32 @test1() {
+define i32 @test1() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @test1(
; CHECK-NEXT: call void @bar()
; CHECK-NEXT: ret i32 0
@@ -12,7 +12,7 @@ define i32 @test1() {
to label %1 unwind label %Rethrow
ret i32 0
Rethrow:
- %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ %exn = landingpad {i8*, i32}
catch i8* null
resume { i8*, i32 } %exn
}
diff --git a/test/Transforms/SimplifyCFG/seh-nounwind.ll b/test/Transforms/SimplifyCFG/seh-nounwind.ll
index 3845e3198909..c380c6ce2ce9 100644
--- a/test/Transforms/SimplifyCFG/seh-nounwind.ll
+++ b/test/Transforms/SimplifyCFG/seh-nounwind.ll
@@ -10,13 +10,13 @@ entry:
ret i32 %div
}
-define i32 @main() nounwind {
+define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
entry:
%call = invoke i32 @div(i32 10, i32 0)
to label %__try.cont unwind label %lpad
lpad:
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
+ %0 = landingpad { i8*, i32 }
catch i8* null
br label %__try.cont
diff --git a/test/Transforms/SimplifyCFG/statepoint-invoke-unwind.ll b/test/Transforms/SimplifyCFG/statepoint-invoke-unwind.ll
new file mode 100644
index 000000000000..994e47eb0d64
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/statepoint-invoke-unwind.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -simplifycfg -S | FileCheck %s
+; Test that statepoint intrinsic is marked with Throwable attribute and it is
+; not optimized into call
+
+declare i64 addrspace(1)* @gc_call()
+declare i32 @llvm.experimental.gc.statepoint.p0f_p1i64f(i64, i32, i64 addrspace(1)* ()*, i32, i32, ...)
+declare i32* @fake_personality_function()
+
+define i32 @test() gc "statepoint-example" personality i32* ()* @fake_personality_function {
+; CHECK-LABEL: test
+entry:
+ ; CHECK-LABEL: entry:
+ ; CHECK-NEXT: %sp = invoke i32 (i64, i32, i64 addrspace(1)* ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64f
+ %sp = invoke i32 (i64, i32, i64 addrspace(1)* ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64f(i64 0, i32 0, i64 addrspace(1)* ()* @gc_call, i32 0, i32 0, i32 0, i32 0)
+ to label %normal unwind label %exception
+
+exception:
+ %lpad = landingpad { i8*, i32 }
+ cleanup
+ ret i32 0
+
+normal:
+ ret i32 1
+}