Skip to content

Commit ed4e75d

Browse files
authored
[CodeGen] Remove AA parameter of isSafeToMove (#100691)
This `AA` parameter is not used and for most uses they just pass a nullptr. The use of `AA` was removed since 8d0383e.
1 parent a820329 commit ed4e75d

23 files changed

+29
-31
lines changed

llvm/include/llvm/CodeGen/MachineInstr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ class MachineInstr
17231723
/// Return true if it is safe to move this instruction. If
17241724
/// SawStore is set to true, it means that there is a store (or call) between
17251725
/// the instruction's location and its intended destination.
1726-
bool isSafeToMove(AAResults *AA, bool &SawStore) const;
1726+
bool isSafeToMove(bool &SawStore) const;
17271727

17281728
/// Returns true if this instruction's memory access aliases the memory
17291729
/// access of Other.

llvm/lib/CodeGen/BranchFolding.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ MachineBasicBlock::iterator findHoistingInsertPosAndDeps(MachineBasicBlock *MBB,
18911891
// Also avoid moving code above predicated instruction since it's hard to
18921892
// reason about register liveness with predicated instruction.
18931893
bool DontMoveAcrossStore = true;
1894-
if (!PI->isSafeToMove(nullptr, DontMoveAcrossStore) || TII->isPredicated(*PI))
1894+
if (!PI->isSafeToMove(DontMoveAcrossStore) || TII->isPredicated(*PI))
18951895
return MBB->end();
18961896

18971897
// Find out what registers are live. Note this routine is ignoring other live
@@ -2015,7 +2015,7 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) {
20152015
break;
20162016

20172017
bool DontMoveAcrossStore = true;
2018-
if (!TIB->isSafeToMove(nullptr, DontMoveAcrossStore))
2018+
if (!TIB->isSafeToMove(DontMoveAcrossStore))
20192019
break;
20202020

20212021
// Remove kills from ActiveDefsSet, these registers had short live ranges.

llvm/lib/CodeGen/DeadMachineInstructionElim.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ bool DeadMachineInstructionElimImpl::isDead(const MachineInstr *MI) const {
9292

9393
// Don't delete instructions with side effects.
9494
bool SawStore = false;
95-
if (!MI->isSafeToMove(nullptr, SawStore) && !MI->isPHI())
95+
if (!MI->isSafeToMove(SawStore) && !MI->isPHI())
9696
return false;
9797

9898
// Examine each operand.

llvm/lib/CodeGen/EarlyIfConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ bool SSAIfConv::canSpeculateInstrs(MachineBasicBlock *MBB) {
235235

236236
// We never speculate stores, so an AA pointer isn't necessary.
237237
bool DontMoveAcrossStore = true;
238-
if (!MI.isSafeToMove(nullptr, DontMoveAcrossStore)) {
238+
if (!MI.isSafeToMove(DontMoveAcrossStore)) {
239239
LLVM_DEBUG(dbgs() << "Can't speculate: " << MI);
240240
return false;
241241
}

llvm/lib/CodeGen/GlobalISel/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ bool llvm::isTriviallyDead(const MachineInstr &MI,
236236
// If we can move an instruction, we can remove it. Otherwise, it has
237237
// a side-effect of some sort.
238238
bool SawStore = false;
239-
if (!MI.isSafeToMove(/*AA=*/nullptr, SawStore) && !MI.isPHI())
239+
if (!MI.isSafeToMove(SawStore) && !MI.isPHI())
240240
return false;
241241

242242
// Instructions without side-effects are dead iff they only define dead vregs.

llvm/lib/CodeGen/IfConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind,
20972097
static bool MaySpeculate(const MachineInstr &MI,
20982098
SmallSet<MCPhysReg, 4> &LaterRedefs) {
20992099
bool SawStore = true;
2100-
if (!MI.isSafeToMove(nullptr, SawStore))
2100+
if (!MI.isSafeToMove(SawStore))
21012101
return false;
21022102

21032103
for (const MachineOperand &MO : MI.operands()) {

llvm/lib/CodeGen/LiveRangeEdit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ bool LiveRangeEdit::foldAsLoad(LiveInterval *LI,
238238
// We also need to make sure it is safe to move the load.
239239
// Assume there are stores between DefMI and UseMI.
240240
bool SawStore = true;
241-
if (!DefMI->isSafeToMove(nullptr, SawStore))
241+
if (!DefMI->isSafeToMove(SawStore))
242242
return false;
243243

244244
LLVM_DEBUG(dbgs() << "Try to fold single def: " << *DefMI
@@ -300,7 +300,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink) {
300300

301301
// Use the same criteria as DeadMachineInstructionElim.
302302
bool SawStore = false;
303-
if (!MI->isSafeToMove(nullptr, SawStore)) {
303+
if (!MI->isSafeToMove(SawStore)) {
304304
LLVM_DEBUG(dbgs() << "Can't delete: " << Idx << '\t' << *MI);
305305
return;
306306
}

llvm/lib/CodeGen/LiveRangeShrink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ bool LiveRangeShrink::runOnMachineFunction(MachineFunction &MF) {
153153
}
154154
}
155155

156-
if (!MI.isSafeToMove(nullptr, SawStore)) {
156+
if (!MI.isSafeToMove(SawStore)) {
157157
// If MI has side effects, it should become a barrier for code motion.
158158
// IOM is rebuild from the next instruction to prevent later
159159
// instructions from being moved before this MI.

llvm/lib/CodeGen/MachineInstr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ void MachineInstr::substituteRegister(Register FromReg, Register ToReg,
12931293
/// isSafeToMove - Return true if it is safe to move this instruction. If
12941294
/// SawStore is set to true, it means that there is a store (or call) between
12951295
/// the instruction's location and its intended destination.
1296-
bool MachineInstr::isSafeToMove(AAResults *AA, bool &SawStore) const {
1296+
bool MachineInstr::isSafeToMove(bool &SawStore) const {
12971297
// Ignore stuff that we obviously can't move.
12981298
//
12991299
// Treat volatile loads as stores. This is not strictly necessary for

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ static bool isCopyFeedingInvariantStore(const MachineInstr &MI,
10751075
bool MachineLICMBase::IsLICMCandidate(MachineInstr &I, MachineLoop *CurLoop) {
10761076
// Check if it's safe to move the instruction.
10771077
bool DontMoveAcrossStore = !HoistConstLoads || !AllowedToHoistLoads[CurLoop];
1078-
if ((!I.isSafeToMove(AA, DontMoveAcrossStore)) &&
1078+
if ((!I.isSafeToMove(DontMoveAcrossStore)) &&
10791079
!(HoistConstStores && isInvariantStore(I, TRI, MRI))) {
10801080
LLVM_DEBUG(dbgs() << "LICM: Instruction not safe to move.\n");
10811081
return false;

0 commit comments

Comments
 (0)