[llvm] 0c1f9b3 - [MachineCombiner] Add `const` to `shouldReduceRegisterPressure` arguments. NFC
Anton Sidorenko via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 2 02:48:38 PDT 2022
Author: Anton Sidorenko
Date: 2022-11-02T12:47:09+03:00
New Revision: 0c1f9b3f17bcb0639d5f2684771ef21c9508632c
URL: https://github.com/llvm/llvm-project/commit/0c1f9b3f17bcb0639d5f2684771ef21c9508632c
DIFF: https://github.com/llvm/llvm-project/commit/0c1f9b3f17bcb0639d5f2684771ef21c9508632c.diff
LOG: [MachineCombiner] Add `const` to `shouldReduceRegisterPressure` arguments. NFC
Differential Revision: https://reviews.llvm.org/D137174
Added:
Modified:
llvm/include/llvm/CodeGen/TargetInstrInfo.h
llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
llvm/lib/Target/PowerPC/PPCInstrInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
index 40663f95fa0a8..189db64609a48 100644
--- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h
+++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
@@ -1148,8 +1148,8 @@ class TargetInstrInfo : public MCInstrInfo {
/// Return true if target supports reassociation of instructions in machine
/// combiner pass to reduce register pressure for a given BB.
virtual bool
- shouldReduceRegisterPressure(MachineBasicBlock *MBB,
- RegisterClassInfo *RegClassInfo) const {
+ shouldReduceRegisterPressure(const MachineBasicBlock *MBB,
+ const RegisterClassInfo *RegClassInfo) const {
return false;
}
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
index 965bdaaa8ecc5..7a7dd2f30e943 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -613,7 +613,7 @@ void PPCInstrInfo::finalizeInsInstrs(
}
bool PPCInstrInfo::shouldReduceRegisterPressure(
- MachineBasicBlock *MBB, RegisterClassInfo *RegClassInfo) const {
+ const MachineBasicBlock *MBB, const RegisterClassInfo *RegClassInfo) const {
if (!EnableFMARegPressureReduction)
return false;
@@ -635,10 +635,11 @@ bool PPCInstrInfo::shouldReduceRegisterPressure(
return false;
const TargetRegisterInfo *TRI = &getRegisterInfo();
- MachineFunction *MF = MBB->getParent();
- MachineRegisterInfo *MRI = &MF->getRegInfo();
+ const MachineFunction *MF = MBB->getParent();
+ const MachineRegisterInfo *MRI = &MF->getRegInfo();
- auto GetMBBPressure = [&](MachineBasicBlock *MBB) -> std::vector<unsigned> {
+ auto GetMBBPressure =
+ [&](const MachineBasicBlock *MBB) -> std::vector<unsigned> {
RegionPressure Pressure;
RegPressureTracker RPTracker(Pressure);
@@ -646,10 +647,7 @@ bool PPCInstrInfo::shouldReduceRegisterPressure(
RPTracker.init(MBB->getParent(), RegClassInfo, nullptr, MBB, MBB->end(),
/*TrackLaneMasks*/ false, /*TrackUntiedDefs=*/true);
- for (MachineBasicBlock::iterator MII = MBB->instr_end(),
- MIE = MBB->instr_begin();
- MII != MIE; --MII) {
- MachineInstr &MI = *std::prev(MII);
+ for (const auto &MI : reverse(*MBB)) {
if (MI.isDebugValue() || MI.isDebugLabel())
continue;
RegisterOperands RegOpers;
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.h b/llvm/lib/Target/PowerPC/PPCInstrInfo.h
index 4c720e251f15c..9f150be7f746c 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.h
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.h
@@ -471,9 +471,9 @@ class PPCInstrInfo : public PPCGenInstrInfo {
/// when the register pressure is high for one BB.
/// Return true if register pressure for \p MBB is high and ABI is supported
/// to reduce register pressure. Otherwise return false.
- bool
- shouldReduceRegisterPressure(MachineBasicBlock *MBB,
- RegisterClassInfo *RegClassInfo) const override;
+ bool shouldReduceRegisterPressure(
+ const MachineBasicBlock *MBB,
+ const RegisterClassInfo *RegClassInfo) const override;
/// Fixup the placeholders we put in genAlternativeCodeSequence() for
/// MachineCombiner.
More information about the llvm-commits
mailing list