summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-05-01 22:40:25 +0000
committerReid Kleckner <reid@kleckner.net>2015-05-01 22:40:25 +0000
commit51476acd77afddd841e7d49e1ffb68621ca8f0b5 (patch)
treefffb456f4fd9a78904c6f803b49426adf16818f2 /llvm/test/CodeGen
parentbb0d7cbee12fe23b5b71faf92ec818bd2317ce35 (diff)
downloadbcm5719-llvm-51476acd77afddd841e7d49e1ffb68621ca8f0b5.tar.gz
bcm5719-llvm-51476acd77afddd841e7d49e1ffb68621ca8f0b5.zip
Re-land "[WinEH] Add an EH registration and state insertion pass for 32-bit x86"
This reverts commit r236340. llvm-svn: 236359
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/inalloca-invoke.ll6
-rw-r--r--llvm/test/CodeGen/X86/win32-eh.ll77
2 files changed, 80 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/X86/inalloca-invoke.ll b/llvm/test/CodeGen/X86/inalloca-invoke.ll
index d6fc76ee50b..cf5cbe142ec 100644
--- a/llvm/test/CodeGen/X86/inalloca-invoke.ll
+++ b/llvm/test/CodeGen/X86/inalloca-invoke.ll
@@ -4,6 +4,7 @@
%frame.reverse = type { %Iter, %Iter }
+declare i32 @pers(...)
declare void @llvm.stackrestore(i8*)
declare i8* @llvm.stacksave()
declare void @begin(%Iter* sret)
@@ -22,8 +23,7 @@ blah:
; CHECK: calll __chkstk
; CHECK: movl %esp, %[[beg:[^ ]*]]
-; CHECK: movl %esp, %[[end:[^ ]*]]
-; CHECK: addl $12, %[[end]]
+; CHECK: leal 12(%[[beg]]), %[[end:[^ ]*]]
call void @begin(%Iter* sret %temp.lvalue)
; CHECK: calll _begin
@@ -49,7 +49,7 @@ invoke.cont5: ; preds = %invoke.cont
ret i32 0
lpad: ; preds = %invoke.cont, %entry
- %lp = landingpad { i8*, i32 } personality i8* null
+ %lp = landingpad { i8*, i32 } personality i32 (...)* @pers
cleanup
unreachable
}
diff --git a/llvm/test/CodeGen/X86/win32-eh.ll b/llvm/test/CodeGen/X86/win32-eh.ll
new file mode 100644
index 00000000000..875949740ec
--- /dev/null
+++ b/llvm/test/CodeGen/X86/win32-eh.ll
@@ -0,0 +1,77 @@
+; RUN: llc -mtriple=i686-pc-windows-msvc < %s | FileCheck %s
+
+declare void @may_throw_or_crash()
+declare i32 @_except_handler3(...)
+declare i32 @_except_handler4(...)
+declare i32 @__CxxFrameHandler3(...)
+declare void @llvm.eh.begincatch(i8*, i8*)
+declare void @llvm.eh.endcatch()
+
+define void @use_except_handler3() {
+ invoke void @may_throw_or_crash()
+ to label %cont unwind label %catchall
+cont:
+ ret void
+catchall:
+ landingpad { i8*, i32 } personality i32 (...)* @_except_handler3
+ catch i8* null
+ br label %cont
+}
+
+; CHECK-LABEL: _use_except_handler3:
+; CHECK: subl ${{[0-9]+}}, %esp
+; CHECK: movl %fs:0, %[[next:[^ ,]*]]
+; CHECK: movl %[[next]], (%esp)
+; CHECK: leal (%esp), %[[node:[^ ,]*]]
+; CHECK: movl %[[node]], %fs:0
+; CHECK: calll _may_throw_or_crash
+; CHECK: movl (%esp), %[[next:[^ ,]*]]
+; CHECK: movl %[[next]], %fs:0
+; CHECK: retl
+
+define void @use_except_handler4() {
+ invoke void @may_throw_or_crash()
+ to label %cont unwind label %catchall
+cont:
+ ret void
+catchall:
+ landingpad { i8*, i32 } personality i32 (...)* @_except_handler4
+ catch i8* null
+ br label %cont
+}
+
+; CHECK-LABEL: _use_except_handler4:
+; CHECK: subl ${{[0-9]+}}, %esp
+; CHECK: leal 8(%esp), %[[node:[^ ,]*]]
+; CHECK: movl %fs:0, %[[next:[^ ,]*]]
+; CHECK: movl %[[next]], 8(%esp)
+; CHECK: movl %[[node]], %fs:0
+; CHECK: calll _may_throw_or_crash
+; CHECK: movl 8(%esp), %[[next:[^ ,]*]]
+; CHECK: movl %[[next]], %fs:0
+; CHECK: retl
+
+define void @use_CxxFrameHandler3() {
+ invoke void @may_throw_or_crash()
+ to label %cont unwind label %catchall
+cont:
+ ret void
+catchall:
+ %ehvals = landingpad { i8*, i32 } personality i32 (...)* @__CxxFrameHandler3
+ catch i8* null
+ %ehptr = extractvalue { i8*, i32 } %ehvals, 0
+ call void @llvm.eh.begincatch(i8* %ehptr, i8* null)
+ call void @llvm.eh.endcatch()
+ br label %cont
+}
+
+; CHECK-LABEL: _use_CxxFrameHandler3:
+; CHECK: subl ${{[0-9]+}}, %esp
+; CHECK: leal 4(%esp), %[[node:[^ ,]*]]
+; CHECK: movl %fs:0, %[[next:[^ ,]*]]
+; CHECK: movl %[[next]], 4(%esp)
+; CHECK: movl %[[node]], %fs:0
+; CHECK: calll _may_throw_or_crash
+; CHECK: movl 4(%esp), %[[next:[^ ,]*]]
+; CHECK: movl %[[next]], %fs:0
+; CHECK: retl
OpenPOWER on IntegriCloud