This is a back end fix for https://reviews.llvm.org/D107523 [[Inline asm] Correct the constrain for function call in inline asm]
llvm-dev link: https://lists.llvm.org/pipermail/llvm-dev/2021-August/152144.html
The following code will generate one more time load for “sincos” with cmd “clang -fasm-blocks t.c -fpic -S -emit-llvm” + “llc t.ll”
t.c:
1 extern void sincos (); 2 void foo (){ 3 __asm{ 4 call sincos 5 ret }; 6 }
t.ll:
1 define void @foo() #0 { 2 entry: 3 call void asm sideeffect inteldialect "call qword ptr ${0:P}\0A\09ret", "*m,~{dirflag},~{fpsr},~{flags}"(void (...)* @sincos) #2, !srcloc !5 4 ret void 5 }
t.s:
1 movq sincos@GOTPCREL(%rip), %rax // now the rax has been the function address “sincos” 2 #APP 3 callq *(%rax) // the call should directly read the %rax, should not “load” it again, it should be “callq *%rax” or better code “call sincos@plt” 4 retq 5 #NO_APP
clang-format: please reformat the code