[PATCH] D129948: [RISCV] Fold stack reload into sext.w by using lw instead of ld.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 17 13:24:58 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:650
+      MI.getOperand(2).isImm() && MI.getOperand(2).getImm() == 0) {
+    MachineMemOperand *MMO = MF.getMachineMemOperand(
+        MachinePointerInfo::getFixedStack(MF, FrameIndex),
----------------
asb wrote:
> craig.topper wrote:
> > asb wrote:
> > > I think you could ditch this and replace the .addMemOperand below with `.setMemRefs(MI.memoperands())`
> > MI is the sext.w, it doesn’t have a memoperand and the load hasn’t been created yet.
> Ah yes, of course it is. Sorry for the confusion.
Should I check for little endian target here? For big endian I think we need to use 4 for the offset.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129948



More information about the llvm-commits mailing list