[llvm] [SystemZ] Enable MachineCombiner for FP reassociation (PR #83546)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 03:43:49 PDT 2024


================
@@ -1336,7 +1414,84 @@ MachineInstr *SystemZInstrInfo::foldMemoryOperandImpl(
     MachineFunction &MF, MachineInstr &MI, ArrayRef<unsigned> Ops,
     MachineBasicBlock::iterator InsertPt, MachineInstr &LoadMI,
     LiveIntervals *LIS) const {
-  return nullptr;
+  MachineRegisterInfo *MRI = &MF.getRegInfo();
+  MachineBasicBlock *MBB = MI.getParent();
+
+  // For reassociable FP operations, any loads have been purposefully left
+  // unfolded so that MachineCombiner can do its work on reg/reg
+  // opcodes. After that, as many loads as possible are now folded.
+  // TODO: This may be beneficial with other opcodes as well as machine-sink
+  // can move loads close to their user in a different MBB, which the isel
+  // matcher did not see.
----------------
uweigand wrote:

I agree this could be more generic, using the instruction maps just like the other foldMemoryOperandImpl.  But that can be done later.

https://github.com/llvm/llvm-project/pull/83546


More information about the llvm-commits mailing list