[llvm] r185704 - [SystemZ] Remove redundant frame MMOs

Richard Sandiford rsandifo at linux.vnet.ibm.com
Fri Jul 5 07:31:25 PDT 2013


Author: rsandifo
Date: Fri Jul  5 09:31:24 2013
New Revision: 185704

URL: http://llvm.org/viewvc/llvm-project?rev=185704&view=rev
Log:
[SystemZ] Remove redundant frame MMOs

This fixes foldMemoryOperandImpl() so that it doesn't create duplicated
frame MMOs.  I hadn't realized when writing r185434 that it was the caller's
responsibility to add these.

No behavioural change intended.

Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp

Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp?rev=185704&r1=185703&r2=185704&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZInstrInfo.cpp Fri Jul  5 09:31:24 2013
@@ -326,17 +326,6 @@ static bool isSimpleBD12Move(const Machi
           MI->getOperand(3).getReg() == 0);
 }
 
-// Return a MachineMemOperand for FrameIndex with flags MMOFlags.
-// Offset is the byte offset from the start of FrameIndex.
-static MachineMemOperand *getFrameMMO(MachineFunction &MF, int FrameIndex,
-                                      uint64_t &Offset, unsigned MMOFlags) {
-  const MachineFrameInfo *MFI = MF.getFrameInfo();
-  const Value *V = PseudoSourceValue::getFixedStack(FrameIndex);
-  return MF.getMachineMemOperand(MachinePointerInfo(V, Offset), MMOFlags,
-                                 MFI->getObjectSize(FrameIndex),
-                                 MFI->getObjectAlignment(FrameIndex));
-}
-
 MachineInstr *
 SystemZInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
                                         MachineInstr *MI,
@@ -368,23 +357,17 @@ SystemZInstrInfo::foldMemoryOperandImpl(
     if (MMO->getSize() == Size && !MMO->isVolatile()) {
       // Handle conversion of loads.
       if (isSimpleBD12Move(MI, SystemZII::SimpleBDXLoad)) {
-        uint64_t Offset = 0;
-        MachineMemOperand *FrameMMO = getFrameMMO(MF, FrameIndex, Offset,
-                                                  MachineMemOperand::MOStore);
         return BuildMI(MF, MI->getDebugLoc(), get(SystemZ::MVC))
-          .addFrameIndex(FrameIndex).addImm(Offset).addImm(Size)
+          .addFrameIndex(FrameIndex).addImm(0).addImm(Size)
           .addOperand(MI->getOperand(1)).addImm(MI->getOperand(2).getImm())
-          .addMemOperand(FrameMMO).addMemOperand(MMO);
+          .addMemOperand(MMO);
       }
       // Handle conversion of stores.
       if (isSimpleBD12Move(MI, SystemZII::SimpleBDXStore)) {
-        uint64_t Offset = 0;
-        MachineMemOperand *FrameMMO = getFrameMMO(MF, FrameIndex, Offset,
-                                                  MachineMemOperand::MOLoad);
         return BuildMI(MF, MI->getDebugLoc(), get(SystemZ::MVC))
           .addOperand(MI->getOperand(1)).addImm(MI->getOperand(2).getImm())
-          .addImm(Size).addFrameIndex(FrameIndex).addImm(Offset)
-          .addMemOperand(MMO).addMemOperand(FrameMMO);
+          .addImm(Size).addFrameIndex(FrameIndex).addImm(0)
+          .addMemOperand(MMO);
       }
     }
   }
@@ -400,15 +383,12 @@ SystemZInstrInfo::foldMemoryOperandImpl(
       assert(AccessBytes != 0 && "Size of access should be known");
       assert(AccessBytes <= Size && "Access outside the frame index");
       uint64_t Offset = Size - AccessBytes;
-      MachineMemOperand *FrameMMO = getFrameMMO(MF, FrameIndex, Offset,
-                                                MachineMemOperand::MOLoad);
       MachineInstrBuilder MIB = BuildMI(MF, MI->getDebugLoc(), get(MemOpcode));
       for (unsigned I = 0; I < OpNum; ++I)
         MIB.addOperand(MI->getOperand(I));
       MIB.addFrameIndex(FrameIndex).addImm(Offset);
       if (MemDesc.TSFlags & SystemZII::HasIndex)
         MIB.addReg(0);
-      MIB.addMemOperand(FrameMMO);
       return MIB;
     }
   }





More information about the llvm-commits mailing list