[PATCH] D118312: [X86] TCRETURNmi fix for 32bit platform

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 3 08:05:15 PST 2022


pengfei added inline comments.


================
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)
----------------
ztong0001 wrote:
> 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).
> 
> 
Shouldn't you check `BasePtr->getNumOperands()`?


================
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))
----------------
ztong0001 wrote:
> 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.
> 
That's fair.


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