diff --git a/llvm/lib/Target/X86/X86InstrCompiler.td b/llvm/lib/Target/X86/X86InstrCompiler.td index ec31675731b7..d3acfc86ab54 100644 --- a/llvm/lib/Target/X86/X86InstrCompiler.td +++ b/llvm/lib/Target/X86/X86InstrCompiler.td @@ -1381,11 +1381,11 @@ def : Pat<(X86tcret_6regs (load addr:$dst), timm:$off), def : Pat<(X86tcret ptr_rc_tailcall:$dst, timm:$off), (INDIRECT_THUNK_TCRETURN64 ptr_rc_tailcall:$dst, timm:$off)>, - Requires<[In64BitMode, IsNotWin64CCFunc, UseIndirectThunkCalls]>; + Requires<[In64BitMode, UseIndirectThunkCalls]>; def : Pat<(X86tcret ptr_rc_tailcall:$dst, timm:$off), (INDIRECT_THUNK_TCRETURN32 ptr_rc_tailcall:$dst, timm:$off)>, - Requires<[Not64BitMode, IsNotWin64CCFunc, UseIndirectThunkCalls]>; + Requires<[Not64BitMode, UseIndirectThunkCalls]>; def : Pat<(X86tcret (i64 tglobaladdr:$dst), timm:$off), (TCRETURNdi64 tglobaladdr:$dst, timm:$off)>, diff --git a/llvm/test/CodeGen/X86/replace-thunk-tail-win.ll b/llvm/test/CodeGen/X86/replace-thunk-tail-win.ll new file mode 100644 index 000000000000..e1d2a3425886 --- /dev/null +++ b/llvm/test/CodeGen/X86/replace-thunk-tail-win.ll @@ -0,0 +1,19 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 +; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=64BIT +; RUN: llc -mtriple=i686-unknown-linux-gnu < %s | FileCheck %s --check-prefix=32BIT + +define void @test(ptr %g) #0 { +; 64BIT-LABEL: test: +; 64BIT: # %bb.0: +; 64BIT-NEXT: movq %rdi, %r11 +; 64BIT-NEXT: jmp __x86_indirect_thunk_r11 # TAILCALL +; +; 32BIT-LABEL: test: +; 32BIT: # %bb.0: +; 32BIT-NEXT: movl {{[0-9]+}}(%esp), %eax +; 32BIT-NEXT: jmp __x86_indirect_thunk_eax # TAILCALL + tail call void %g() + ret void +} + +attributes #0 = { "target-features"="+retpoline-external-thunk" }