[PATCH] D118312: [X86] TCRETURNmi fix for 32bit platform
Tong Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 2 10:44:49 PST 2022
ztong0001 added a comment.
Hi Pengfei,
Thanks for you comment.
Please see my inline comments.
Thanks!
- Tong
================
Comment at: llvm/lib/Target/X86/X86InstrCompiler.td:1246
+ else if (N->getNumOperands() && isa<GlobalAddressSDNode>(BasePtr->getOperand(0)))
+ NumRegs = 3;
+ for (unsigned i = 3, e = N->getNumOperands(); i != e; ++i)
----------------
pengfei wrote:
> Why do we need to check `N->getNumOperands()`?
Hi Pengfei,
Thanks for you comment.
I see BasePtr could be a <FrameIndexSDNode> that has 0 operand and I'm not sure what else are there so I added this to proactively avoid crash when calling getOperand(0).
================
Comment at: llvm/lib/Target/X86/X86InstrCompiler.td:1247
+ NumRegs = 3;
+ for (unsigned i = 3, e = N->getNumOperands(); i != e; ++i)
+ if (isa<RegisterSDNode>(N->getOperand(i)) && ( NumRegs-- == 0))
----------------
pengfei wrote:
> Should we add 2 more tests for the 2 `NumRegs = 3`?
Please correct me if I'm wrong, from my understanding the two NumRegs=3 case are covered already in the following tests:
Line 1244:
LLVM :: CodeGen/X86/sibcall-2.ll
LLVM :: CodeGen/X86/sibcall.ll
Line 1247:
LLVM:: CodeGen/X86/hipe-cc.ll
Without those two NumRegs=3 lines the above tests would fail.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118312/new/
https://reviews.llvm.org/D118312
More information about the llvm-commits
mailing list