[PATCH] D91020: [X86] Unbind the ebx with GOT address in regcall calling convention

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 7 18:42:33 PST 2020


xiangzhangllvm added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:4123
     if (!isTailCall) {
-      RegsToPass.push_back(std::make_pair(
+      if (CallConv != CallingConv::X86_RegCall)
+        RegsToPass.push_back(std::make_pair(
----------------
LuoYuanke wrote:
> Would you add comments to explain why EBX is avoid in regcall?
I didn't see the rule in regcall calling convertion, let me check how I descript here better.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:4136
 
       // Note: The actual moving to ECX is done further down.
       GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);
----------------
LuoYuanke wrote:
> Would you add a test case for tail call? Is there any conflict to ECX?
I check here local before, For X86, tail call will not work with regcall, For X86_64 it will work, but X86_64 don't fix ebx with GOT point.
please check the following case, it will not generate jump  for 2nd command.

```
  1 ; llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic
  2 ; llc -mtriple=i386-unknown-linux-gnu -relocation-model=pic  <-tailcallopt>
  3
  4 declare x86_regcallcc void @regcall_not_lazy(i32 %a0, i32 %b0)
  5
  6 define void @tail_call_regcall() nounwind {
  7   tail call x86_regcallcc void @regcall_not_lazy(i32 0, i32 1)
  8   ret void
  9 }
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91020/new/

https://reviews.llvm.org/D91020



More information about the llvm-commits mailing list