[llvm] b8c86dc - [SystemZ] Remove custom implementation of optimizeLoadInst [NFC] (#133123)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 28 10:37:45 PDT 2025
Author: Philip Reames
Date: 2025-03-28T10:37:41-07:00
New Revision: b8c86dc7699d3c561bcbee143d2022561d5cc8a3
URL: https://github.com/llvm/llvm-project/commit/b8c86dc7699d3c561bcbee143d2022561d5cc8a3
DIFF: https://github.com/llvm/llvm-project/commit/b8c86dc7699d3c561bcbee143d2022561d5cc8a3.diff
LOG: [SystemZ] Remove custom implementation of optimizeLoadInst [NFC] (#133123)
In 236f938ef, I introduced a generic version of this routine. I believe
that the SystemZ specific version of this is less general than the
generic version, and is thus unrequired. I wasn't 100% given the
difference in sub-register, multiple use and defs, but from the SystemZ
code, it looks like those cases simply don't arise?
Added:
Modified:
llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
llvm/lib/Target/SystemZ/SystemZInstrInfo.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
index 519baec5989df..91a4aa9c73010 100644
--- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
@@ -670,31 +670,6 @@ void SystemZInstrInfo::insertSelect(MachineBasicBlock &MBB,
.addImm(CCValid).addImm(CCMask);
}
-MachineInstr *SystemZInstrInfo::optimizeLoadInstr(MachineInstr &MI,
- const MachineRegisterInfo *MRI,
- Register &FoldAsLoadDefReg,
- MachineInstr *&DefMI) const {
- // Check whether we can move the DefMI load, and that it only has one use.
- DefMI = MRI->getVRegDef(FoldAsLoadDefReg);
- assert(DefMI);
- bool SawStore = false;
- if (!DefMI->isSafeToMove(SawStore) || !MRI->hasOneNonDBGUse(FoldAsLoadDefReg))
- return nullptr;
-
- int UseOpIdx =
- MI.findRegisterUseOperandIdx(FoldAsLoadDefReg, /*TRI=*/nullptr);
- assert(UseOpIdx != -1 && "Expected FoldAsLoadDefReg to be used by MI.");
-
- // Check whether we can fold the load.
- if (MachineInstr *FoldMI =
- foldMemoryOperand(MI, {((unsigned)UseOpIdx)}, *DefMI)) {
- FoldAsLoadDefReg = 0;
- return FoldMI;
- }
-
- return nullptr;
-}
-
bool SystemZInstrInfo::foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
Register Reg,
MachineRegisterInfo *MRI) const {
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.h b/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
index a8d282dd9e417..8b82af61e669a 100644
--- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
+++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.h
@@ -258,10 +258,6 @@ class SystemZInstrInfo : public SystemZGenInstrInfo {
const DebugLoc &DL, Register DstReg,
ArrayRef<MachineOperand> Cond, Register TrueReg,
Register FalseReg) const override;
- MachineInstr *optimizeLoadInstr(MachineInstr &MI,
- const MachineRegisterInfo *MRI,
- Register &FoldAsLoadDefReg,
- MachineInstr *&DefMI) const override;
bool foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, Register Reg,
MachineRegisterInfo *MRI) const override;
More information about the llvm-commits
mailing list