diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -33956,11 +33956,7 @@ bool X86TargetLowering::isInlineAsmTargetBranch( const SmallVectorImpl &AsmStrs, unsigned OpNo) const { StringRef InstrStr = getInstrStrFromOpNo(AsmStrs, OpNo); - - if (InstrStr.contains("call")) - return true; - - return false; + return InstrStr.startswith("call") || InstrStr.startswith("jmp"); } /// Provide custom lowering hooks for some operations. diff --git a/llvm/test/CodeGen/X86/inline-asm-function-call-pic.ll b/llvm/test/CodeGen/X86/inline-asm-function-call-pic.ll --- a/llvm/test/CodeGen/X86/inline-asm-function-call-pic.ll +++ b/llvm/test/CodeGen/X86/inline-asm-function-call-pic.ll @@ -15,6 +15,7 @@ ; __asm { ; call static_func ; call extern_func +; jmp extern_func ; shr eax, 0 ; shr ebx, 0 ; shr ecx, 0 @@ -40,6 +41,7 @@ ; CHECK-EMPTY: ; CHECK-NEXT: calll static_func ; CHECK-NEXT: calll extern_func@PLT +; CHECK-NEXT: jmp extern_func@PLT ; CHECK-NEXT: shrl $0, %eax ; CHECK-NEXT: shrl $0, %ebx ; CHECK-NEXT: shrl $0, %ecx @@ -52,7 +54,7 @@ ; CHECK-NEXT: #NO_APP entry: %call = tail call i32 @static_func() - tail call void asm sideeffect inteldialect "call dword ptr ${0:P}\0A\09call dword ptr ${1:P}\0A\09shr eax, $$0\0A\09shr ebx, $$0\0A\09shr ecx, $$0\0A\09shr edx, $$0\0A\09shr edi, $$0\0A\09shr esi, $$0\0A\09shr ebp, $$0\0A\09shr esp, $$0", "*m,*m,~{eax},~{ebp},~{ebx},~{ecx},~{edi},~{edx},~{flags},~{esi},~{esp},~{dirflag},~{fpsr},~{flags}"(ptr nonnull elementtype(i32 (...)) @static_func, ptr nonnull elementtype(i32 (...)) @extern_func) #0 + tail call void asm sideeffect inteldialect "call ${0:P}\0A\09call ${1:P}\0A\09jmp ${1:P}\0A\09shr eax, $$0\0A\09shr ebx, $$0\0A\09shr ecx, $$0\0A\09shr edx, $$0\0A\09shr edi, $$0\0A\09shr esi, $$0\0A\09shr ebp, $$0\0A\09shr esp, $$0", "*m,*m,~{eax},~{ebp},~{ebx},~{ecx},~{edi},~{edx},~{flags},~{esi},~{esp},~{dirflag},~{fpsr},~{flags}"(ptr nonnull elementtype(i32 (...)) @static_func, ptr nonnull elementtype(i32 (...)) @extern_func) #0 ret void }