diff options
author | Reid Kleckner <rnk@google.com> | 2019-09-03 22:27:27 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-09-03 22:27:27 +0000 |
commit | 3fa07dee94368643cdbc38fb24d8d2734b9bf42c (patch) | |
tree | 47b305d9f92cc54ae59568aa30c4a0c358645563 /llvm/test | |
parent | 49e7ee4dd58f57b67d3f1b953d2f81ae6ad75964 (diff) | |
download | bcm5719-llvm-3fa07dee94368643cdbc38fb24d8d2734b9bf42c.tar.gz bcm5719-llvm-3fa07dee94368643cdbc38fb24d8d2734b9bf42c.zip |
Revert [Windows] Disable TrapUnreachable for Win64, add SEH_NoReturn
This reverts r370525 (git commit 0bb1630685fba255fa93def92603f064c2ffd203)
Also reverts r370543 (git commit 185ddc08eed6542781040b8499ef7ad15c8ae9f4)
The approach I took only works for functions marked `noreturn`. In
general, a call that is not known to be noreturn may be followed by
unreachable for other reasons. For example, there could be multiple call
sites to a function that throws sometimes, and at some call sites, it is
known to always throw, so it is followed by unreachable. We need to
insert an `int3` in these cases to pacify the Windows unwinder.
I think this probably deserves its own standalone, Win64-only fixup pass
that runs after block placement. Implementing that will take some time,
so let's revert to TrapUnreachable in the mean time.
llvm-svn: 370829
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/WinEH/wineh-noret-cleanup.ll | 7 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/br-fold.ll | 6 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/catchpad-lifetime.ll | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/catchpad-regmask.ll | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/catchret-regmask.ll | 7 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/empty-function.ll | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/funclet-layout.ll | 16 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/noreturn-call-win64.ll | 53 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/pr24374.ll | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/trap.ll | 9 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/unreachable-trap.ll | 11 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/win64_call_epi.ll | 5 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/win64_eh.ll | 8 | ||||
-rw-r--r-- | llvm/test/DebugInfo/COFF/local-variable-gap.ll | 2 |
14 files changed, 28 insertions, 108 deletions
diff --git a/llvm/test/CodeGen/WinEH/wineh-noret-cleanup.ll b/llvm/test/CodeGen/WinEH/wineh-noret-cleanup.ll index 7d4d833aa9b..9f7c995e5e7 100644 --- a/llvm/test/CodeGen/WinEH/wineh-noret-cleanup.ll +++ b/llvm/test/CodeGen/WinEH/wineh-noret-cleanup.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: sed -e s/.Cxx:// %s | llc -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefix=CXX ; RUN: sed -e s/.Seh:// %s | llc -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefix=SEH @@ -68,13 +69,13 @@ catch.body.2: ; SEH-NEXT: .long .Ltmp0@IMGREL+1 ; SEH-NEXT: .long .Ltmp1@IMGREL+1 ; SEH-NEXT: .long dummy_filter@IMGREL -; SEH-NEXT: .long .LBB0_5@IMGREL +; SEH-NEXT: .long .LBB0_2@IMGREL ; SEH-NEXT: .long .Ltmp2@IMGREL+1 ; SEH-NEXT: .long .Ltmp3@IMGREL+1 -; SEH-NEXT: .long "?dtor$2@?0?test@4HA"@IMGREL +; SEH-NEXT: .long "?dtor$5@?0?test@4HA"@IMGREL ; SEH-NEXT: .long 0 ; SEH-NEXT: .long .Ltmp2@IMGREL+1 ; SEH-NEXT: .long .Ltmp3@IMGREL+1 ; SEH-NEXT: .long dummy_filter@IMGREL -; SEH-NEXT: .long .LBB0_5@IMGREL +; SEH-NEXT: .long .LBB0_2@IMGREL ; SEH-NEXT: .Llsda_end0: diff --git a/llvm/test/CodeGen/X86/br-fold.ll b/llvm/test/CodeGen/X86/br-fold.ll index 6cd9b78c1c7..bcd672eb517 100644 --- a/llvm/test/CodeGen/X86/br-fold.ll +++ b/llvm/test/CodeGen/X86/br-fold.ll @@ -5,18 +5,18 @@ ; RUN: llc -mtriple=x86_64-scei-ps4 < %s | FileCheck -check-prefix=PS4 %s ; X64_DARWIN: orq -; X64_DARWIN-NEXT: ud2 +; X64-DARWIN-NEXT: ud2 ; X64_LINUX: orq %rax, %rcx ; X64_LINUX-NEXT: jne ; X64_LINUX-NEXT: %bb8.i329 ; X64_WINDOWS: orq %rax, %rcx -; X64_WINDOWS-NEXT: jne +; X64_WINDOWS-NEXT: ud2 ; X64_WINDOWS_GNU: movq .refptr._ZN11xercesc_2_513SchemaSymbols21fgURI_SCHEMAFORSCHEMAE(%rip), %rax ; X64_WINDOWS_GNU: orq .refptr._ZN11xercesc_2_56XMLUni16fgNotationStringE(%rip), %rax -; X64_WINDOWS_GNU-NEXT: jne +; X64_WINDOWS_GNU-NEXT: ud2 ; PS4: orq %rax, %rcx ; PS4-NEXT: ud2 diff --git a/llvm/test/CodeGen/X86/catchpad-lifetime.ll b/llvm/test/CodeGen/X86/catchpad-lifetime.ll index 8a6d4cbd271..d85adec360c 100644 --- a/llvm/test/CodeGen/X86/catchpad-lifetime.ll +++ b/llvm/test/CodeGen/X86/catchpad-lifetime.ll @@ -7,8 +7,6 @@ declare void @throw() declare i32 @__CxxFrameHandler3(...) -declare void @llvm.trap() - define void @test1() personality i32 (...)* @__CxxFrameHandler3 { entry: %alloca2 = alloca i8*, align 4 @@ -32,7 +30,6 @@ catch.pad: ; preds = %catch.dispatch %bc2 = bitcast i8** %alloca2 to i8* call void @llvm.lifetime.start.p0i8(i64 4, i8* %bc2) store volatile i8* null, i8** %alloca1 - call void @llvm.trap() unreachable ; CHECK-LABEL: "?catch$2@?0?test1@4HA" @@ -70,7 +67,6 @@ catch.pad: ; preds = %catch.dispatch %bc2 = bitcast i8** %alloca2 to i8* call void @llvm.lifetime.start.p0i8(i64 4, i8* %bc2) store volatile i8* null, i8** %alloca1 - call void @llvm.trap() unreachable ; CHECK-LABEL: "?catch$2@?0?test2@4HA" diff --git a/llvm/test/CodeGen/X86/catchpad-regmask.ll b/llvm/test/CodeGen/X86/catchpad-regmask.ll index 0981f8e15f1..0d436f6eb59 100644 --- a/llvm/test/CodeGen/X86/catchpad-regmask.ll +++ b/llvm/test/CodeGen/X86/catchpad-regmask.ll @@ -75,7 +75,7 @@ unreachable: ; preds = %entry ; CHECK: popq %rbp ; CHECK: retq -; CHECK: "?catch${{[0-9]+}}@?0?global_array@4HA": +; CHECK: "?catch$2@?0?global_array@4HA": ; CHECK: pushq %rbp ; CHECK: movslq {{.*}}, %[[idx:[^ ]*]] ; CHECK: leaq array(%rip), %[[base:[^ ]*]] @@ -122,7 +122,7 @@ unreachable: ; preds = %entry ; CHECK: popq %rbp ; CHECK: retq -; CHECK: "?catch${{[0-9]+}}@?0?access_imported@4HA": +; CHECK: "?catch$2@?0?access_imported@4HA": ; CHECK: pushq %rbp ; CHECK: movq __imp_imported(%rip), %[[base:[^ ]*]] ; CHECK: movl $222, (%[[base]]) diff --git a/llvm/test/CodeGen/X86/catchret-regmask.ll b/llvm/test/CodeGen/X86/catchret-regmask.ll index 4af57e109f1..1231172a7e9 100644 --- a/llvm/test/CodeGen/X86/catchret-regmask.ll +++ b/llvm/test/CodeGen/X86/catchret-regmask.ll @@ -6,7 +6,6 @@ target triple = "x86_64-pc-windows-msvc" declare i32 @__CxxFrameHandler3(...) declare void @throw() noreturn uwtable declare i8* @getval() -declare void @llvm.trap() define i8* @reload_out_of_pad(i8* %arg) #0 personality i32 (...)* @__CxxFrameHandler3 { assertPassed: @@ -20,7 +19,6 @@ catch: ; This block *must* appear after the catchret to test the bug. ; FIXME: Make this an MIR test so we can control MBB layout. unreachable: - call void @llvm.trap() unreachable catch.dispatch: @@ -37,7 +35,7 @@ return: ; CHECK: movq -[[arg_slot]](%rbp), %rax # 8-byte Reload ; CHECK: retq -; CHECK: "?catch${{[0-9]+}}@?0?reload_out_of_pad@4HA": +; CHECK: "?catch$3@?0?reload_out_of_pad@4HA": ; CHECK-NOT: Reload ; CHECK: retq @@ -52,7 +50,6 @@ catch: catchret from %cp to label %return unreachable: - call void @llvm.trap() unreachable catch.dispatch: @@ -68,7 +65,7 @@ return: ; CHECK: movq -[[val_slot:[0-9]+]](%rbp), %rax # 8-byte Reload ; CHECK: retq -; CHECK: "?catch${{[0-9]+}}@?0?spill_in_pad@4HA": +; CHECK: "?catch$3@?0?spill_in_pad@4HA": ; CHECK: callq getval ; CHECK: movq %rax, -[[val_slot]](%rbp) # 8-byte Spill ; CHECK: retq diff --git a/llvm/test/CodeGen/X86/empty-function.ll b/llvm/test/CodeGen/X86/empty-function.ll index 7d908311ec8..92bebd0ab1a 100644 --- a/llvm/test/CodeGen/X86/empty-function.ll +++ b/llvm/test/CodeGen/X86/empty-function.ll @@ -15,7 +15,7 @@ entry: ; CHECK-LABEL: f: ; WIN32: nop -; WIN64: nop +; WIN64: ud2 ; LINUX-NOT: nop ; LINUX-NOT: ud2 diff --git a/llvm/test/CodeGen/X86/funclet-layout.ll b/llvm/test/CodeGen/X86/funclet-layout.ll index 72f60ea72d4..0942645cf5a 100644 --- a/llvm/test/CodeGen/X86/funclet-layout.ll +++ b/llvm/test/CodeGen/X86/funclet-layout.ll @@ -9,8 +9,6 @@ target triple = "x86_64-pc-windows-msvc" @"\01??_7type_info@@6B@" = external constant i8* @"\01??_R0H@8" = internal global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" } -declare void @llvm.trap() - define void @test1(i1 %B) personality i32 (...)* @__CxxFrameHandler3 { entry: invoke void @g() @@ -33,7 +31,6 @@ try.cont: ret void unreachable: - call void @llvm.trap() unreachable } @@ -79,7 +76,6 @@ try.cont.5: ; preds = %try.cont ret i32 0 unreachable: ; preds = %catch, %entry - call void @llvm.trap() unreachable } @@ -129,13 +125,11 @@ try.cont: ; preds = %entry br i1 %V, label %exit_one, label %exit_two exit_one: - tail call void @g() - call void @llvm.trap() + tail call void @exit(i32 0) unreachable exit_two: - tail call void @g() - call void @llvm.trap() + tail call void @exit(i32 0) unreachable } @@ -144,7 +138,7 @@ exit_two: ; The entry funclet contains %entry and %try.cont ; CHECK: # %entry ; CHECK: # %try.cont -; CHECK: callq g +; CHECK: callq exit ; CHECK-NOT: # exit_one ; CHECK-NOT: # exit_two ; CHECK: ud2 @@ -152,12 +146,12 @@ exit_two: ; The catch(...) funclet contains %catch.2 ; CHECK: # %catch.2{{$}} ; CHECK: callq exit -; CHECK-NEXT: int3 +; CHECK: ud2 ; The catch(int) funclet contains %catch ; CHECK: # %catch{{$}} ; CHECK: callq exit -; CHECK-NEXT: int3 +; CHECK: ud2 declare void @exit(i32) noreturn nounwind declare void @_CxxThrowException(i8*, %eh.ThrowInfo*) diff --git a/llvm/test/CodeGen/X86/noreturn-call-win64.ll b/llvm/test/CodeGen/X86/noreturn-call-win64.ll deleted file mode 100644 index 6289eef6bb4..00000000000 --- a/llvm/test/CodeGen/X86/noreturn-call-win64.ll +++ /dev/null @@ -1,53 +0,0 @@ -; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s - -; Function Attrs: noinline nounwind optnone uwtable -define dso_local i32 @foo() { -entry: - %call = call i32 @cond() - %tobool = icmp ne i32 %call, 0 - br i1 %tobool, label %if.then, label %if.end - -if.then: ; preds = %entry - call void @abort1() - unreachable - -if.end: ; preds = %entry - %call1 = call i32 @cond() - %tobool2 = icmp ne i32 %call1, 0 - br i1 %tobool2, label %if.then3, label %if.end4 - -if.then3: ; preds = %if.end - call void @abort2() - unreachable - -if.end4: ; preds = %if.end - %call5 = call i32 @cond() - %tobool6 = icmp ne i32 %call5, 0 - br i1 %tobool6, label %if.then7, label %if.end8 - -if.then7: ; preds = %if.end4 - call void @abort3() - unreachable - -if.end8: ; preds = %if.end4 - ret i32 0 -} - -; CHECK-LABEL: foo: -; CHECK: callq cond -; CHECK: callq cond -; CHECK: callq cond -; We don't need int3's between these calls to abort, since they won't confuse -; the unwinder. -; CHECK: callq abort1 -; CHECK-NEXT: # %if.then3 -; CHECK: callq abort2 -; CHECK-NEXT: # %if.then7 -; CHECK: callq abort3 -; CHECK-NEXT: int3 - -declare dso_local i32 @cond() - -declare dso_local void @abort1() noreturn -declare dso_local void @abort2() noreturn -declare dso_local void @abort3() noreturn diff --git a/llvm/test/CodeGen/X86/pr24374.ll b/llvm/test/CodeGen/X86/pr24374.ll index 7ad05e8b77a..dab3b3f4159 100644 --- a/llvm/test/CodeGen/X86/pr24374.ll +++ b/llvm/test/CodeGen/X86/pr24374.ll @@ -31,6 +31,6 @@ define void @g() { unreachable } ; CHECK-LABEL: g: -; CHECK: nop +; CHECK: ud2 attributes #0 = { nounwind } diff --git a/llvm/test/CodeGen/X86/trap.ll b/llvm/test/CodeGen/X86/trap.ll index 452be48a605..ca33f9e6b4e 100644 --- a/llvm/test/CodeGen/X86/trap.ll +++ b/llvm/test/CodeGen/X86/trap.ll @@ -1,19 +1,13 @@ ; RUN: llc < %s -mtriple=i686-apple-darwin8 -mcpu=yonah | FileCheck %s -check-prefix=DARWIN ; RUN: llc < %s -mtriple=i686-unknown-linux -mcpu=yonah | FileCheck %s -check-prefix=LINUX ; RUN: llc < %s -mtriple=x86_64-scei-ps4 | FileCheck %s -check-prefix=PS4 -; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s -check-prefix=WIN64 ; DARWIN-LABEL: test0: ; DARWIN: ud2 ; LINUX-LABEL: test0: ; LINUX: ud2 -; FIXME: PS4 probably doesn't want two ud2s. ; PS4-LABEL: test0: ; PS4: ud2 -; PS4: ud2 -; WIN64-LABEL: test0: -; WIN64: ud2 -; WIN64-NOT: ud2 define i32 @test0() noreturn nounwind { entry: tail call void @llvm.trap( ) @@ -26,9 +20,6 @@ entry: ; LINUX: int3 ; PS4-LABEL: test1: ; PS4: int $65 -; WIN64-LABEL: test1: -; WIN64: int3 -; WIN64-NOT: ud2 define i32 @test1() noreturn nounwind { entry: tail call void @llvm.debugtrap( ) diff --git a/llvm/test/CodeGen/X86/unreachable-trap.ll b/llvm/test/CodeGen/X86/unreachable-trap.ll index ee1a11c7677..8de0510ed38 100644 --- a/llvm/test/CodeGen/X86/unreachable-trap.ll +++ b/llvm/test/CodeGen/X86/unreachable-trap.ll @@ -1,13 +1,10 @@ -; RUN: llc -o - %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,NORMAL -; RUN: llc -o - %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefixes=CHECK,NORMAL -; RUN: llc -o - %s -mtriple=x86_64-scei-ps4 | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN +; RUN: llc -o - %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN ; RUN: llc -o - %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefixes=CHECK,NO_TRAP_AFTER_NORETURN ; CHECK-LABEL: call_exit: ; CHECK: callq {{_?}}exit ; TRAP_AFTER_NORETURN: ud2 ; NO_TRAP_AFTER_NORETURN-NOT: ud2 -; NORMAL-NOT: ud2 define i32 @call_exit() noreturn nounwind { tail call void @exit(i32 0) unreachable @@ -17,17 +14,13 @@ define i32 @call_exit() noreturn nounwind { ; CHECK: ud2 ; TRAP_AFTER_NORETURN: ud2 ; NO_TRAP_AFTER_NORETURN-NOT: ud2 -; NORMAL-NOT: ud2 define i32 @trap() noreturn nounwind { tail call void @llvm.trap() unreachable } ; CHECK-LABEL: unreachable: -; TRAP_AFTER_NORETURN: ud2 -; NO_TRAP_AFTER_NORETURN: ud2 -; NORMAL-NOT: ud2 -; NORMAL: # -- End function +; CHECK: ud2 define i32 @unreachable() noreturn nounwind { unreachable } diff --git a/llvm/test/CodeGen/X86/win64_call_epi.ll b/llvm/test/CodeGen/X86/win64_call_epi.ll index 3e8f57e6514..096cbe41c54 100644 --- a/llvm/test/CodeGen/X86/win64_call_epi.ll +++ b/llvm/test/CodeGen/X86/win64_call_epi.ll @@ -24,9 +24,10 @@ catch: ; WIN64: nop ; WIN64: addq ${{[0-9]+}}, %rsp ; WIN64: retq -; Check for 'int3' after noreturn call. +; Check for 'ud2' after noreturn call ; WIN64: callq _Unwind_Resume -; WIN64-NEXT: int3 +; WIN64-NEXT: ud2 +; WIN64: .seh_endproc ; Check it still works when blocks are reordered. diff --git a/llvm/test/CodeGen/X86/win64_eh.ll b/llvm/test/CodeGen/X86/win64_eh.ll index caadea4fe2e..7f6a3629613 100644 --- a/llvm/test/CodeGen/X86/win64_eh.ll +++ b/llvm/test/CodeGen/X86/win64_eh.ll @@ -125,11 +125,11 @@ endtryfinally: ; WIN64-LABEL: foo4: ; WIN64: .seh_proc foo4 ; WIN64: .seh_handler _d_eh_personality, @unwind, @except -; NORM: subq $40, %rsp -; ATOM: leaq -40(%rsp), %rsp -; WIN64: .seh_stackalloc 40 +; NORM: subq $56, %rsp +; ATOM: leaq -56(%rsp), %rsp +; WIN64: .seh_stackalloc 56 ; WIN64: .seh_endprologue -; WIN64: addq $40, %rsp +; WIN64: addq $56, %rsp ; WIN64: ret ; WIN64: .seh_handlerdata ; WIN64: .seh_endproc diff --git a/llvm/test/DebugInfo/COFF/local-variable-gap.ll b/llvm/test/DebugInfo/COFF/local-variable-gap.ll index 5bbc058b5b3..db8de632739 100644 --- a/llvm/test/DebugInfo/COFF/local-variable-gap.ll +++ b/llvm/test/DebugInfo/COFF/local-variable-gap.ll @@ -54,7 +54,7 @@ ; ASM: [[p_b2:\.Ltmp[0-9]+]]: ; ASM: #DEBUG_VALUE: p <- $esi ; ASM: callq call_noreturn -; ASM: int3 +; ASM: ud2 ; ASM: .Lfunc_end0: ; ASM: .short {{.*}} # Record length |