[PATCH] D89855: [PowerPC] Extend folding RLWINM + RLWINM to post-RA.

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 19:08:29 PST 2020


shchenz added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:3260
+    SrcMI = MRI->getVRegDef(FoldingReg);
+  } else {
+    SrcMI = getDefMIPostRA(FoldingReg, MI, OtherIntermediateUse);
----------------
lkail wrote:
> I suggest checking `Register::isPhysicalRegister` explicitly, since `Reg` might also be a stackslot.
Could you please explain more here? this is after RA, if `FoldingReg` is a stackslot, we should get `r1/x1`? I don't understand how `Register::isPhysicalRegister` would change the semantic here? Thanks.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:3289
+    // only do the folding if SrcMI is going to be erased.
+    if (!CanErase && SrcMI->definesRegister(SrcMI->getOperand(1).getReg()))
+      return false;
----------------
lkail wrote:
> Suggest using `modifiesRegister` or it'll miss case like `$x3 = rlwinm $r3, ...`
That would not happen, for `RLWINM`, we get input and output are both r3, for `RLWINM8` we get input and output are both x3.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89855



More information about the llvm-commits mailing list