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

Tong Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 3 08:37:05 PST 2022


ztong0001 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)
----------------
pengfei wrote:
> 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()`?
Ouch! You are right. It should be BasePtr instead of N. I will submit a revised version. 
Thanks!


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