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;

llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ static bool isCandidate(const MachineInstr *MI, Register &DefedReg,
158158
Register FrameReg) {
159159
DefedReg = MCRegister::NoRegister;
160160
bool SawStore = true;
161-
if (!MI->isSafeToMove(nullptr, SawStore) || MI->isImplicitDef() ||
162-
MI->isInlineAsm())
161+
if (!MI->isSafeToMove(SawStore) || MI->isImplicitDef() || MI->isInlineAsm())
163162
return false;
164163
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
165164
const MachineOperand &MO = MI->getOperand(i);

llvm/lib/CodeGen/MachineSink.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI,
374374

375375
// Check if it's safe to move the instruction.
376376
bool SawStore = true;
377-
if (!MI.isSafeToMove(AA, SawStore))
377+
if (!MI.isSafeToMove(SawStore))
378378
return false;
379379

380380
// Convergent operations may not be made control-dependent on additional
@@ -687,7 +687,7 @@ void MachineSinking::FindCycleSinkCandidates(
687687
continue;
688688
}
689689
bool DontMoveAcrossStore = true;
690-
if (!MI.isSafeToMove(AA, DontMoveAcrossStore)) {
690+
if (!MI.isSafeToMove(DontMoveAcrossStore)) {
691691
LLVM_DEBUG(dbgs() << "CycleSink: Instruction not safe to move.\n");
692692
continue;
693693
}
@@ -1654,7 +1654,7 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore,
16541654
return false;
16551655

16561656
// Check if it's safe to move the instruction.
1657-
if (!MI.isSafeToMove(AA, SawStore))
1657+
if (!MI.isSafeToMove(SawStore))
16581658
return false;
16591659

16601660
// Convergent operations may not be made control-dependent on additional
@@ -1705,7 +1705,7 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore,
17051705
bool TryBreak = false;
17061706
bool Store =
17071707
MI.mayLoad() ? hasStoreBetween(ParentBlock, SuccToSinkTo, MI) : true;
1708-
if (!MI.isSafeToMove(AA, Store)) {
1708+
if (!MI.isSafeToMove(Store)) {
17091709
LLVM_DEBUG(dbgs() << " *** NOTE: Won't sink load along critical edge.\n");
17101710
TryBreak = true;
17111711
}

llvm/lib/CodeGen/ModuloSchedule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ void ModuloScheduleExpander::removeDeadInstructions(MachineBasicBlock *KernelBB,
739739
bool SawStore = false;
740740
// Check if it's safe to remove the instruction due to side effects.
741741
// We can, and want to, remove Phis here.
742-
if (!MI->isSafeToMove(nullptr, SawStore) && !MI->isPHI()) {
742+
if (!MI->isSafeToMove(SawStore) && !MI->isPHI()) {
743743
++MI;
744744
continue;
745745
}

llvm/lib/CodeGen/RegisterCoalescer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP,
13201320
if (!definesFullReg(*DefMI, SrcReg))
13211321
return false;
13221322
bool SawStore = false;
1323-
if (!DefMI->isSafeToMove(AA, SawStore))
1323+
if (!DefMI->isSafeToMove(SawStore))
13241324
return false;
13251325
const MCInstrDesc &MCID = DefMI->getDesc();
13261326
if (MCID.getNumDefs() != 1)

llvm/lib/CodeGen/TwoAddressInstructionPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ bool TwoAddressInstructionImpl::rescheduleMIBelowKill(
948948
return false;
949949

950950
bool SeenStore = true;
951-
if (!MI->isSafeToMove(AA, SeenStore))
951+
if (!MI->isSafeToMove(SeenStore))
952952
return false;
953953

954954
if (TII->getInstrLatency(InstrItins, *MI) > 1)
@@ -1131,7 +1131,7 @@ bool TwoAddressInstructionImpl::rescheduleKillAboveMI(
11311131
return false;
11321132

11331133
bool SeenStore = true;
1134-
if (!KillMI->isSafeToMove(AA, SeenStore))
1134+
if (!KillMI->isSafeToMove(SeenStore))
11351135
return false;
11361136

11371137
SmallVector<Register, 2> Uses;

llvm/lib/Target/AArch64/AArch64ConditionalCompares.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ bool SSACCmpConv::canSpeculateInstrs(MachineBasicBlock *MBB,
416416

417417
// We never speculate stores, so an AA pointer isn't necessary.
418418
bool DontMoveAcrossStore = true;
419-
if (!I.isSafeToMove(nullptr, DontMoveAcrossStore)) {
419+
if (!I.isSafeToMove(DontMoveAcrossStore)) {
420420
LLVM_DEBUG(dbgs() << "Can't speculate: " << I);
421421
return false;
422422
}

llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,7 @@ ARMBaseInstrInfo::canFoldIntoMOVCC(Register Reg, const MachineRegisterInfo &MRI,
23112311
return nullptr;
23122312
}
23132313
bool DontMoveAcrossStores = true;
2314-
if (!MI->isSafeToMove(/* AliasAnalysis = */ nullptr, DontMoveAcrossStores))
2314+
if (!MI->isSafeToMove(DontMoveAcrossStores))
23152315
return nullptr;
23162316
return MI;
23172317
}

llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ bool DeadCodeElimination::runOnNode(MachineDomTreeNode *N) {
10371037
if (MI->isInlineAsm())
10381038
continue;
10391039
// Delete PHIs if possible.
1040-
if (!MI->isPHI() && !MI->isSafeToMove(nullptr, Store))
1040+
if (!MI->isPHI() && !MI->isSafeToMove(Store))
10411041
continue;
10421042

10431043
bool AllDead = true;

llvm/lib/Target/Hexagon/HexagonGenInsert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ bool HexagonGenInsert::removeDeadCode(MachineDomTreeNode *N) {
14511451
Opc == TargetOpcode::LIFETIME_END)
14521452
continue;
14531453
bool Store = false;
1454-
if (MI->isInlineAsm() || !MI->isSafeToMove(nullptr, Store))
1454+
if (MI->isInlineAsm() || !MI->isSafeToMove(Store))
14551455
continue;
14561456

14571457
bool AllDead = true;

llvm/lib/Target/Lanai/LanaiInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ static MachineInstr *canFoldIntoSelect(Register Reg,
483483
return nullptr;
484484
}
485485
bool DontMoveAcrossStores = true;
486-
if (!MI->isSafeToMove(/*AliasAnalysis=*/nullptr, DontMoveAcrossStores))
486+
if (!MI->isSafeToMove(DontMoveAcrossStores))
487487
return nullptr;
488488
return MI;
489489
}

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ static MachineInstr *canFoldAsPredicatedOp(Register Reg,
13651365
return nullptr;
13661366
}
13671367
bool DontMoveAcrossStores = true;
1368-
if (!MI->isSafeToMove(/* AliasAnalysis = */ nullptr, DontMoveAcrossStores))
1368+
if (!MI->isSafeToMove(DontMoveAcrossStores))
13691369
return nullptr;
13701370
return MI;
13711371
}

llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,7 @@ MachineInstr *SystemZInstrInfo::optimizeLoadInstr(MachineInstr &MI,
631631
DefMI = MRI->getVRegDef(FoldAsLoadDefReg);
632632
assert(DefMI);
633633
bool SawStore = false;
634-
if (!DefMI->isSafeToMove(nullptr, SawStore) ||
635-
!MRI->hasOneNonDBGUse(FoldAsLoadDefReg))
634+
if (!DefMI->isSafeToMove(SawStore) || !MRI->hasOneNonDBGUse(FoldAsLoadDefReg))
636635
return nullptr;
637636

638637
int UseOpIdx =

llvm/lib/Target/X86/X86InstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5588,7 +5588,7 @@ MachineInstr *X86InstrInfo::optimizeLoadInstr(MachineInstr &MI,
55885588
DefMI = MRI->getVRegDef(FoldAsLoadDefReg);
55895589
assert(DefMI);
55905590
bool SawStore = false;
5591-
if (!DefMI->isSafeToMove(nullptr, SawStore))
5591+
if (!DefMI->isSafeToMove(SawStore))
55925592
return nullptr;
55935593

55945594
// Collect information about virtual register operands of MI.

0 commit comments

Comments
 (0)