[llvm] r304913 - [SystemZ] Propagate MachineMemOperands
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 7 07:08:36 PDT 2017
Author: jonpa
Date: Wed Jun 7 09:08:34 2017
New Revision: 304913
URL: http://llvm.org/viewvc/llvm-project?rev=304913&view=rev
Log:
[SystemZ] Propagate MachineMemOperands
In emitCondStore() and emitMemMemWrapper().
Review: Ulrich Weigand
Modified:
llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=304913&r1=304912&r2=304913&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Wed Jun 7 09:08:34 2017
@@ -5367,12 +5367,24 @@ MachineBasicBlock *SystemZTargetLowering
if (STOCOpcode && !IndexReg && Subtarget.hasLoadStoreOnCond()) {
if (Invert)
CCMask ^= CCValid;
+
+ // ISel pattern matching also adds a load memory operand of the same
+ // address, so take special care to find the storing memory operand.
+ MachineMemOperand *MMO = nullptr;
+ for (auto *I : MI.memoperands())
+ if (I->isStore()) {
+ MMO = I;
+ break;
+ }
+
BuildMI(*MBB, MI, DL, TII->get(STOCOpcode))
- .addReg(SrcReg)
- .add(Base)
- .addImm(Disp)
- .addImm(CCValid)
- .addImm(CCMask);
+ .addReg(SrcReg)
+ .add(Base)
+ .addImm(Disp)
+ .addImm(CCValid)
+ .addImm(CCMask)
+ .addMemOperand(MMO);
+
MI.eraseFromParent();
return MBB;
}
@@ -5950,7 +5962,8 @@ MachineBasicBlock *SystemZTargetLowering
.addImm(DestDisp)
.addImm(ThisLength)
.add(SrcBase)
- .addImm(SrcDisp);
+ .addImm(SrcDisp)
+ ->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
DestDisp += ThisLength;
SrcDisp += ThisLength;
Length -= ThisLength;
More information about the llvm-commits
mailing list