diff options
Diffstat (limited to 'llvm/test/CodeGen/X86/win32-eh.ll')
| -rw-r--r-- | llvm/test/CodeGen/X86/win32-eh.ll | 33 |
1 files changed, 25 insertions, 8 deletions
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() { |

