diff options
| author | Reid Kleckner <rnk@google.com> | 2015-10-09 20:39:39 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2015-10-09 20:39:39 +0000 |
| commit | d880dc7509c014eae74ece7542703bac2673f9e2 (patch) | |
| tree | bb54ecb582f2284e78a17c9c3061cd04deeebe50 /llvm/test/CodeGen | |
| parent | 3b27bf4d47464bb6f14368c2a0a395bad1669c79 (diff) | |
| download | bcm5719-llvm-d880dc7509c014eae74ece7542703bac2673f9e2.tar.gz bcm5719-llvm-d880dc7509c014eae74ece7542703bac2673f9e2.zip | |
[SEH] Remember to emit the last invoke range for SEH
This wasn't very observable in execution tests, because usually there is
an invoke in the catchpad that unwinds the the catchendpad but never
actually throws.
llvm-svn: 249898
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/X86/seh-catch-all.ll | 36 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/seh-catchpad.ll | 12 |
2 files changed, 26 insertions, 22 deletions
diff --git a/llvm/test/CodeGen/X86/seh-catch-all.ll b/llvm/test/CodeGen/X86/seh-catch-all.ll index 00a2455655b..0c4f33f6300 100644 --- a/llvm/test/CodeGen/X86/seh-catch-all.ll +++ b/llvm/test/CodeGen/X86/seh-catch-all.ll @@ -2,6 +2,7 @@ @str = linkonce_odr unnamed_addr constant [27 x i8] c"GetExceptionCode(): 0x%lx\0A\00", align 1 +declare i32 @llvm.eh.exceptioncode(token) declare i32 @__C_specific_handler(...) declare void @crash() declare i32 @printf(i8* nocapture readonly, ...) nounwind @@ -11,20 +12,20 @@ entry: invoke void @crash() to label %__try.cont unwind label %lpad -lpad: - %0 = landingpad { i8*, i32 } - catch i8* null - %1 = extractvalue { i8*, i32 } %0, 0 - %2 = ptrtoint i8* %1 to i64 - %3 = trunc i64 %2 to i32 - call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0), i32 %3) - br label %__try.cont - __try.cont: ret i32 0 -eh.resume: - resume { i8*, i32 } %0 +lpad: + %p = catchpad [i8* null, i32 64, i8* null] + to label %catchall unwind label %endpad + +catchall: + %code = call i32 @llvm.eh.exceptioncode(token %p) + call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0), i32 %code) + catchret %p to label %__try.cont + +endpad: + catchendpad unwind to caller } ; Check that we can get the exception code from eax to the printf. @@ -32,18 +33,17 @@ eh.resume: ; CHECK-LABEL: main: ; CHECK: callq crash ; CHECK: retq -; CHECK: # Block address taken +; CHECK: .LBB0_2: # %lpad +; CHECK: # %catchall ; CHECK: leaq str(%rip), %rcx ; CHECK: movl %eax, %edx ; CHECK: callq printf ; CHECK: .seh_handlerdata -; CHECK-NEXT: .text -; CHECK-NEXT: .Ltmp{{[0-9]+}} -; CHECK-NEXT: .seh_endproc -; CHECK-NEXT: .section .xdata,"dr" -; CHECK-NEXT: .long 1 +; CHECK-NEXT: .long (.Llsda_end0-.Llsda_begin0)/16 +; CHECK-NEXT: .Llsda_begin0: ; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL ; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL+1 ; CHECK-NEXT: .long 1 -; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL +; CHECK-NEXT: .long .LBB0_2@IMGREL +; CHECK-NEXT: .Llsda_end0: diff --git a/llvm/test/CodeGen/X86/seh-catchpad.ll b/llvm/test/CodeGen/X86/seh-catchpad.ll index 865596d206f..e981744db42 100644 --- a/llvm/test/CodeGen/X86/seh-catchpad.ll +++ b/llvm/test/CodeGen/X86/seh-catchpad.ll @@ -130,22 +130,26 @@ ehcleanup.end: ; preds = %ehcleanup ; CHECK: .seh_handlerdata ; CHECK-NEXT: .long (.Llsda_end0-.Llsda_begin0)/16 ; CHECK-NEXT: .Llsda_begin0: -; CHECK-NEXT: .long .Ltmp0@IMGREL +; CHECK-NEXT: .long .Ltmp0@IMGREL+1 ; CHECK-NEXT: .long .Ltmp1@IMGREL+1 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long .LBB1_[[except1bb]]@IMGREL -; CHECK-NEXT: .long .Ltmp0@IMGREL +; CHECK-NEXT: .long .Ltmp0@IMGREL+1 ; CHECK-NEXT: .long .Ltmp1@IMGREL+1 ; CHECK-NEXT: .long "?filt$0@0@main@@"@IMGREL ; CHECK-NEXT: .long .LBB1_[[except2bb]]@IMGREL -; CHECK-NEXT: .long .Ltmp2@IMGREL +; CHECK-NEXT: .long .Ltmp2@IMGREL+1 ; CHECK-NEXT: .long .Ltmp3@IMGREL+1 ; CHECK-NEXT: .long "?dtor$[[finbb:[0-9]+]]@?0?main@4HA"@IMGREL ; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long .Ltmp2@IMGREL +; CHECK-NEXT: .long .Ltmp2@IMGREL+1 ; CHECK-NEXT: .long .Ltmp3@IMGREL+1 ; CHECK-NEXT: .long "?filt$0@0@main@@"@IMGREL ; CHECK-NEXT: .long .LBB1_6@IMGREL +; CHECK-NEXT: .long .Ltmp6@IMGREL+1 +; CHECK-NEXT: .long .Ltmp5@IMGREL+1 +; CHECK-NEXT: .long "?filt$0@0@main@@"@IMGREL +; CHECK-NEXT: .long .LBB1_6@IMGREL ; CHECK-NEXT: .Llsda_end0: ; CHECK: .text |

