diff options
| author | Reid Kleckner <reid@kleckner.net> | 2015-06-11 23:37:18 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2015-06-11 23:37:18 +0000 |
| commit | 81d1cc00b7d6de7303deb31ab8569ff3fa4abf56 (patch) | |
| tree | 22a47dcad0b233cdf40fea05a33a8f8bba27cde5 /llvm/test/CodeGen | |
| parent | b5aee61c3617b726245182b48df8ab573d75d1a9 (diff) | |
| download | bcm5719-llvm-81d1cc00b7d6de7303deb31ab8569ff3fa4abf56.tar.gz bcm5719-llvm-81d1cc00b7d6de7303deb31ab8569ff3fa4abf56.zip | |
[WinEH] Put finally pointers in the handler scope table field
We were putting them in the filter field, which is correct for 64-bit
but wrong for 32-bit.
Also switch the order of scope table entry emission so outermost entries
are emitted first, and fix an obvious state assignment bug.
llvm-svn: 239574
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/X86/seh-finally.ll | 41 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/seh-safe-div-win32.ll | 6 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/win32-eh.ll | 33 |
3 files changed, 57 insertions, 23 deletions
diff --git a/llvm/test/CodeGen/X86/seh-finally.ll b/llvm/test/CodeGen/X86/seh-finally.ll index 91baed570f2..9deffe13e01 100644 --- a/llvm/test/CodeGen/X86/seh-finally.ll +++ b/llvm/test/CodeGen/X86/seh-finally.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=X64 +; RUN: sed -e 's/__C_specific_handler/_except_handler3/' %s | \ +; RUN: llc -mtriple=i686-windows-msvc | FileCheck %s --check-prefix=X86 @str_recovered = internal unnamed_addr constant [10 x i8] c"recovered\00", align 1 @@ -32,17 +34,32 @@ terminate.lpad: ; preds = %lpad unreachable } -; CHECK-LABEL: main: -; CHECK: .seh_handlerdata -; CHECK-NEXT: .long 1 -; CHECK-NEXT: .long .Ltmp0@IMGREL -; CHECK-NEXT: .long .Ltmp1@IMGREL -; CHECK-NEXT: .long main.cleanup@IMGREL -; CHECK-NEXT: .long 0 - -; CHECK-LABEL: main.cleanup: -; CHECK: callq puts -; CHECK: retq +; X64-LABEL: main: +; X64: retq + +; X64: .seh_handlerdata +; X64-NEXT: .long 1 +; X64-NEXT: .long .Ltmp0@IMGREL +; X64-NEXT: .long .Ltmp1@IMGREL +; X64-NEXT: .long main.cleanup@IMGREL +; X64-NEXT: .long 0 + +; X64-LABEL: main.cleanup: +; X64: callq puts +; X64: retq + +; X86-LABEL: _main: +; X86: retl + +; X86: .section .xdata,"dr" +; X86: L__ehtable$main: +; X86-NEXT: .long -1 +; X86-NEXT: .long 0 +; X86-NEXT: .long _main.cleanup + +; X86-LABEL: _main.cleanup: +; X86: calll _puts +; X86: retl declare i32 @__C_specific_handler(...) diff --git a/llvm/test/CodeGen/X86/seh-safe-div-win32.ll b/llvm/test/CodeGen/X86/seh-safe-div-win32.ll index ab58a4b99ca..b5f9a3688ba 100644 --- a/llvm/test/CodeGen/X86/seh-safe-div-win32.ll +++ b/llvm/test/CodeGen/X86/seh-safe-div-win32.ll @@ -92,11 +92,11 @@ __try.cont: ; CHECK: .section .xdata,"dr" ; CHECK: L__ehtable$safe_div: ; CHECK-NEXT: .long -1 -; CHECK-NEXT: .long _safe_div_filt0 -; CHECK-NEXT: .long [[handler0]] -; CHECK-NEXT: .long 0 ; CHECK-NEXT: .long _safe_div_filt1 ; CHECK-NEXT: .long [[handler1]] +; CHECK-NEXT: .long 0 +; CHECK-NEXT: .long _safe_div_filt0 +; CHECK-NEXT: .long [[handler0]] define void @try_body(i32* %r, i32* %n, i32* %d) { entry: diff --git a/llvm/test/CodeGen/X86/win32-eh.ll b/llvm/test/CodeGen/X86/win32-eh.ll index 6d816d7770c..584b409c705 100644 --- a/llvm/test/CodeGen/X86/win32-eh.ll +++ b/llvm/test/CodeGen/X86/win32-eh.ll @@ -6,16 +6,27 @@ declare i32 @_except_handler4(...) declare i32 @__CxxFrameHandler3(...) declare void @llvm.eh.begincatch(i8*, i8*) declare void @llvm.eh.endcatch() +declare i32 @llvm.eh.typeid.for(i8*) + +define internal i32 @catchall_filt() { + ret i32 1 +} define void @use_except_handler3() { +entry: 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 + %0 = landingpad { i8*, i32 } personality i32 (...)* @_except_handler3 + catch i8* bitcast (i32 ()* @catchall_filt to i8*) + %1 = extractvalue { i8*, i32 } %0, 1 + %2 = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 ()* @catchall_filt to i8*)) #4 + %matches = icmp eq i32 %1, %2 + br i1 %matches, label %cont, label %eh.resume +eh.resume: + resume { i8*, i32 } %0 } ; CHECK-LABEL: _use_except_handler3: @@ -37,18 +48,24 @@ catchall: ; CHECK: .section .xdata,"dr" ; CHECK-LABEL: L__ehtable$use_except_handler3: ; CHECK-NEXT: .long -1 -; CHECK-NEXT: .long 0 +; CHECK-NEXT: .long _catchall_filt ; CHECK-NEXT: .long Ltmp{{[0-9]+}} define void @use_except_handler4() { +entry: 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 + %0 = landingpad { i8*, i32 } personality i32 (...)* @_except_handler4 + catch i8* bitcast (i32 ()* @catchall_filt to i8*) + %1 = extractvalue { i8*, i32 } %0, 1 + %2 = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 ()* @catchall_filt to i8*)) #4 + %matches = icmp eq i32 %1, %2 + br i1 %matches, label %cont, label %eh.resume +eh.resume: + resume { i8*, i32 } %0 } ; CHECK-LABEL: _use_except_handler4: @@ -77,7 +94,7 @@ catchall: ; CHECK-NEXT: .long 9999 ; CHECK-NEXT: .long 0 ; CHECK-NEXT: .long -2 -; CHECK-NEXT: .long 0 +; CHECK-NEXT: .long _catchall_filt ; CHECK-NEXT: .long Ltmp{{[0-9]+}} define void @use_CxxFrameHandler3() { |

