summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Feature/seh-nounwind.ll32
-rw-r--r--llvm/test/Other/2009-03-31-CallGraph.ll2
-rw-r--r--llvm/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll15
-rw-r--r--llvm/test/Transforms/PruneEH/seh-nounwind.ll31
-rw-r--r--llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll4
-rw-r--r--llvm/test/Transforms/SimplifyCFG/seh-nounwind.ll31
6 files changed, 100 insertions, 15 deletions
diff --git a/llvm/test/Feature/seh-nounwind.ll b/llvm/test/Feature/seh-nounwind.ll
new file mode 100644
index 00000000000..203471649df
--- /dev/null
+++ b/llvm/test/Feature/seh-nounwind.ll
@@ -0,0 +1,32 @@
+; RUN: opt -S -O2 < %s | FileCheck %s
+
+; Feature test that verifies that all optimizations leave asynch personality
+; invokes of nounwind functions alone.
+; The @div function in this test can fault, even though it can't
+; throw a synchronous exception.
+
+define i32 @div(i32 %n, i32 %d) nounwind noinline {
+entry:
+ %div = sdiv i32 %n, %d
+ ret i32 %div
+}
+
+define i32 @main() nounwind {
+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*)
+ catch i8* null
+ br label %__try.cont
+
+__try.cont:
+ %retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ]
+ ret i32 %retval.0
+}
+
+; CHECK-LABEL: define i32 @main()
+; CHECK: invoke i32 @div(i32 10, i32 0)
+
+declare i32 @__C_specific_handler(...)
diff --git a/llvm/test/Other/2009-03-31-CallGraph.ll b/llvm/test/Other/2009-03-31-CallGraph.ll
index 864903cffba..1e178308464 100644
--- a/llvm/test/Other/2009-03-31-CallGraph.ll
+++ b/llvm/test/Other/2009-03-31-CallGraph.ll
@@ -7,6 +7,8 @@ ok1:
ret void
lpad1:
+ landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ cleanup
invoke void @f4()
to label %ok2 unwind label %lpad2
diff --git a/llvm/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll b/llvm/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll
deleted file mode 100644
index a01070308be..00000000000
--- a/llvm/test/Transforms/PruneEH/2003-11-21-PHIUpdate.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-; RUN: opt < %s -prune-eh -disable-output
-
-define internal void @callee() {
- ret void
-}
-
-define i32 @caller() {
-; <label>:0
- invoke void @callee( )
- to label %E unwind label %E
-E: ; preds = %0, %0
- %X = phi i32 [ 0, %0 ], [ 0, %0 ] ; <i32> [#uses=1]
- ret i32 %X
-}
-
diff --git a/llvm/test/Transforms/PruneEH/seh-nounwind.ll b/llvm/test/Transforms/PruneEH/seh-nounwind.ll
new file mode 100644
index 00000000000..4b69ae4b28d
--- /dev/null
+++ b/llvm/test/Transforms/PruneEH/seh-nounwind.ll
@@ -0,0 +1,31 @@
+; RUN: opt -S -prune-eh < %s | FileCheck %s
+
+; Don't remove invokes of nounwind functions if the personality handles async
+; exceptions. The @div function in this test can fault, even though it can't
+; throw a synchronous exception.
+
+define i32 @div(i32 %n, i32 %d) nounwind {
+entry:
+ %div = sdiv i32 %n, %d
+ ret i32 %div
+}
+
+define i32 @main() nounwind {
+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*)
+ catch i8* null
+ br label %__try.cont
+
+__try.cont:
+ %retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ]
+ ret i32 %retval.0
+}
+
+; CHECK-LABEL: define i32 @main()
+; CHECK: invoke i32 @div(i32 10, i32 0)
+
+declare i32 @__C_specific_handler(...)
diff --git a/llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll b/llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll
index a90e0727625..76f41e8fc21 100644
--- a/llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll
+++ b/llvm/test/Transforms/SimplifyCFG/2007-11-22-InvokeNoUnwind.ll
@@ -12,5 +12,9 @@ Cont: ; preds = %0
ret i32 0
Other: ; preds = %0
+ landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
+ catch i8* null
ret i32 1
}
+
+declare i32 @__gxx_personality_v0(...)
diff --git a/llvm/test/Transforms/SimplifyCFG/seh-nounwind.ll b/llvm/test/Transforms/SimplifyCFG/seh-nounwind.ll
new file mode 100644
index 00000000000..3845e319890
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/seh-nounwind.ll
@@ -0,0 +1,31 @@
+; RUN: opt -S -simplifycfg < %s | FileCheck %s
+
+; Don't remove invokes of nounwind functions if the personality handles async
+; exceptions. The @div function in this test can fault, even though it can't
+; throw a synchronous exception.
+
+define i32 @div(i32 %n, i32 %d) nounwind {
+entry:
+ %div = sdiv i32 %n, %d
+ ret i32 %div
+}
+
+define i32 @main() nounwind {
+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*)
+ catch i8* null
+ br label %__try.cont
+
+__try.cont:
+ %retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ]
+ ret i32 %retval.0
+}
+
+; CHECK-LABEL: define i32 @main()
+; CHECK: invoke i32 @div(i32 10, i32 0)
+
+declare i32 @__C_specific_handler(...)
OpenPOWER on IntegriCloud