[llvm] 6c7134b - [RISCV] Don't create MachineMemOperand in foldMemoryOperandImpl. (#109840)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 15:54:05 PDT 2024


Author: Craig Topper
Date: 2024-09-24T15:54:02-07:00
New Revision: 6c7134b2667b3abbbb3f56352a0020f398994d14

URL: https://github.com/llvm/llvm-project/commit/6c7134b2667b3abbbb3f56352a0020f398994d14
DIFF: https://github.com/llvm/llvm-project/commit/6c7134b2667b3abbbb3f56352a0020f398994d14.diff

LOG: [RISCV] Don't create MachineMemOperand in foldMemoryOperandImpl. (#109840)

The caller already does this after we return. I think it will overwrite
any MMO we add.

I'm the original author of this code and I'm not sure why I did it.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 41f93fde17d329..b594531ccb0958 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -736,8 +736,6 @@ MachineInstr *RISCVInstrInfo::foldMemoryOperandImpl(
     MachineFunction &MF, MachineInstr &MI, ArrayRef<unsigned> Ops,
     MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS,
     VirtRegMap *VRM) const {
-  const MachineFrameInfo &MFI = MF.getFrameInfo();
-
   // The below optimizations narrow the load so they are only valid for little
   // endian.
   // TODO: Support big endian by adding an offset into the frame object?
@@ -776,17 +774,11 @@ MachineInstr *RISCVInstrInfo::foldMemoryOperandImpl(
     break;
   }
 
-  MachineMemOperand *MMO = MF.getMachineMemOperand(
-      MachinePointerInfo::getFixedStack(MF, FrameIndex),
-      MachineMemOperand::MOLoad, MFI.getObjectSize(FrameIndex),
-      MFI.getObjectAlign(FrameIndex));
-
   Register DstReg = MI.getOperand(0).getReg();
   return BuildMI(*MI.getParent(), InsertPt, MI.getDebugLoc(), get(LoadOpc),
                  DstReg)
       .addFrameIndex(FrameIndex)
-      .addImm(0)
-      .addMemOperand(MMO);
+      .addImm(0);
 }
 
 void RISCVInstrInfo::movImm(MachineBasicBlock &MBB,


        


More information about the llvm-commits mailing list