diff options
23 files changed, 29 insertions, 31 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index 229f515..04c8144 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -1723,7 +1723,7 @@ public: /// Return true if it is safe to move this instruction. If /// SawStore is set to true, it means that there is a store (or call) between /// the instruction's location and its intended destination. - bool isSafeToMove(AAResults *AA, bool &SawStore) const; + bool isSafeToMove(bool &SawStore) const; /// Returns true if this instruction's memory access aliases the memory /// access of Other. diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index 92a03eb5..1dc2785 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -1891,7 +1891,7 @@ MachineBasicBlock::iterator findHoistingInsertPosAndDeps(MachineBasicBlock *MBB, // Also avoid moving code above predicated instruction since it's hard to // reason about register liveness with predicated instruction. bool DontMoveAcrossStore = true; - if (!PI->isSafeToMove(nullptr, DontMoveAcrossStore) || TII->isPredicated(*PI)) + if (!PI->isSafeToMove(DontMoveAcrossStore) || TII->isPredicated(*PI)) return MBB->end(); // Find out what registers are live. Note this routine is ignoring other live @@ -2015,7 +2015,7 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { break; bool DontMoveAcrossStore = true; - if (!TIB->isSafeToMove(nullptr, DontMoveAcrossStore)) + if (!TIB->isSafeToMove(DontMoveAcrossStore)) break; // Remove kills from ActiveDefsSet, these registers had short live ranges. diff --git a/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp b/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp index 578854c..7fc25cd 100644 --- a/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp +++ b/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp @@ -92,7 +92,7 @@ bool DeadMachineInstructionElimImpl::isDead(const MachineInstr *MI) const { // Don't delete instructions with side effects. bool SawStore = false; - if (!MI->isSafeToMove(nullptr, SawStore) && !MI->isPHI()) + if (!MI->isSafeToMove(SawStore) && !MI->isPHI()) return false; // Examine each operand. diff --git a/llvm/lib/CodeGen/EarlyIfConversion.cpp b/llvm/lib/CodeGen/EarlyIfConversion.cpp index a5c9949..d506c62 100644 --- a/llvm/lib/CodeGen/EarlyIfConversion.cpp +++ b/llvm/lib/CodeGen/EarlyIfConversion.cpp @@ -235,7 +235,7 @@ bool SSAIfConv::canSpeculateInstrs(MachineBasicBlock *MBB) { // We never speculate stores, so an AA pointer isn't necessary. bool DontMoveAcrossStore = true; - if (!MI.isSafeToMove(nullptr, DontMoveAcrossStore)) { + if (!MI.isSafeToMove(DontMoveAcrossStore)) { LLVM_DEBUG(dbgs() << "Can't speculate: " << MI); return false; } diff --git a/llvm/lib/CodeGen/GlobalISel/Utils.cpp b/llvm/lib/CodeGen/GlobalISel/Utils.cpp index c906f3a..0806648 100644 --- a/llvm/lib/CodeGen/GlobalISel/Utils.cpp +++ b/llvm/lib/CodeGen/GlobalISel/Utils.cpp @@ -236,7 +236,7 @@ bool llvm::isTriviallyDead(const MachineInstr &MI, // If we can move an instruction, we can remove it. Otherwise, it has // a side-effect of some sort. bool SawStore = false; - if (!MI.isSafeToMove(/*AA=*/nullptr, SawStore) && !MI.isPHI()) + if (!MI.isSafeToMove(SawStore) && !MI.isPHI()) return false; // Instructions without side-effects are dead iff they only define dead vregs. diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp index f378956..ba5605a 100644 --- a/llvm/lib/CodeGen/IfConversion.cpp +++ b/llvm/lib/CodeGen/IfConversion.cpp @@ -2097,7 +2097,7 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind, static bool MaySpeculate(const MachineInstr &MI, SmallSet<MCPhysReg, 4> &LaterRedefs) { bool SawStore = true; - if (!MI.isSafeToMove(nullptr, SawStore)) + if (!MI.isSafeToMove(SawStore)) return false; for (const MachineOperand &MO : MI.operands()) { diff --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp index 7b7b545..c3c581d 100644 --- a/llvm/lib/CodeGen/LiveRangeEdit.cpp +++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp @@ -238,7 +238,7 @@ bool LiveRangeEdit::foldAsLoad(LiveInterval *LI, // We also need to make sure it is safe to move the load. // Assume there are stores between DefMI and UseMI. bool SawStore = true; - if (!DefMI->isSafeToMove(nullptr, SawStore)) + if (!DefMI->isSafeToMove(SawStore)) return false; LLVM_DEBUG(dbgs() << "Try to fold single def: " << *DefMI @@ -300,7 +300,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink) { // Use the same criteria as DeadMachineInstructionElim. bool SawStore = false; - if (!MI->isSafeToMove(nullptr, SawStore)) { + if (!MI->isSafeToMove(SawStore)) { LLVM_DEBUG(dbgs() << "Can't delete: " << Idx << '\t' << *MI); return; } diff --git a/llvm/lib/CodeGen/LiveRangeShrink.cpp b/llvm/lib/CodeGen/LiveRangeShrink.cpp index af7d6c4..3e3e3e5 100644 --- a/llvm/lib/CodeGen/LiveRangeShrink.cpp +++ b/llvm/lib/CodeGen/LiveRangeShrink.cpp @@ -153,7 +153,7 @@ bool LiveRangeShrink::runOnMachineFunction(MachineFunction &MF) { } } - if (!MI.isSafeToMove(nullptr, SawStore)) { + if (!MI.isSafeToMove(SawStore)) { // If MI has side effects, it should become a barrier for code motion. // IOM is rebuild from the next instruction to prevent later // instructions from being moved before this MI. diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index be64e9c..583bc1b 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1293,7 +1293,7 @@ void MachineInstr::substituteRegister(Register FromReg, Register ToReg, /// isSafeToMove - Return true if it is safe to move this instruction. If /// SawStore is set to true, it means that there is a store (or call) between /// the instruction's location and its intended destination. -bool MachineInstr::isSafeToMove(AAResults *AA, bool &SawStore) const { +bool MachineInstr::isSafeToMove(bool &SawStore) const { // Ignore stuff that we obviously can't move. // // Treat volatile loads as stores. This is not strictly necessary for diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp index d75df2a..1e4bf4b 100644 --- a/llvm/lib/CodeGen/MachineLICM.cpp +++ b/llvm/lib/CodeGen/MachineLICM.cpp @@ -1075,7 +1075,7 @@ static bool isCopyFeedingInvariantStore(const MachineInstr &MI, bool MachineLICMBase::IsLICMCandidate(MachineInstr &I, MachineLoop *CurLoop) { // Check if it's safe to move the instruction. bool DontMoveAcrossStore = !HoistConstLoads || !AllowedToHoistLoads[CurLoop]; - if ((!I.isSafeToMove(AA, DontMoveAcrossStore)) && + if ((!I.isSafeToMove(DontMoveAcrossStore)) && !(HoistConstStores && isInvariantStore(I, TRI, MRI))) { LLVM_DEBUG(dbgs() << "LICM: Instruction not safe to move.\n"); return false; diff --git a/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp b/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp index 1f596cd..9d650e4 100644 --- a/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp +++ b/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp @@ -158,8 +158,7 @@ static bool isCandidate(const MachineInstr *MI, Register &DefedReg, Register FrameReg) { DefedReg = MCRegister::NoRegister; bool SawStore = true; - if (!MI->isSafeToMove(nullptr, SawStore) || MI->isImplicitDef() || - MI->isInlineAsm()) + if (!MI->isSafeToMove(SawStore) || MI->isImplicitDef() || MI->isInlineAsm()) return false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index 4b3ff57..f10b98c 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -374,7 +374,7 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI, // Check if it's safe to move the instruction. bool SawStore = true; - if (!MI.isSafeToMove(AA, SawStore)) + if (!MI.isSafeToMove(SawStore)) return false; // Convergent operations may not be made control-dependent on additional @@ -687,7 +687,7 @@ void MachineSinking::FindCycleSinkCandidates( continue; } bool DontMoveAcrossStore = true; - if (!MI.isSafeToMove(AA, DontMoveAcrossStore)) { + if (!MI.isSafeToMove(DontMoveAcrossStore)) { LLVM_DEBUG(dbgs() << "CycleSink: Instruction not safe to move.\n"); continue; } @@ -1654,7 +1654,7 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore, return false; // Check if it's safe to move the instruction. - if (!MI.isSafeToMove(AA, SawStore)) + if (!MI.isSafeToMove(SawStore)) return false; // Convergent operations may not be made control-dependent on additional @@ -1705,7 +1705,7 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore, bool TryBreak = false; bool Store = MI.mayLoad() ? hasStoreBetween(ParentBlock, SuccToSinkTo, MI) : true; - if (!MI.isSafeToMove(AA, Store)) { + if (!MI.isSafeToMove(Store)) { LLVM_DEBUG(dbgs() << " *** NOTE: Won't sink load along critical edge.\n"); TryBreak = true; } diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp index 0f29ebe..dae0cb2 100644 --- a/llvm/lib/CodeGen/ModuloSchedule.cpp +++ b/llvm/lib/CodeGen/ModuloSchedule.cpp @@ -739,7 +739,7 @@ void ModuloScheduleExpander::removeDeadInstructions(MachineBasicBlock *KernelBB, bool SawStore = false; // Check if it's safe to remove the instruction due to side effects. // We can, and want to, remove Phis here. - if (!MI->isSafeToMove(nullptr, SawStore) && !MI->isPHI()) { + if (!MI->isSafeToMove(SawStore) && !MI->isPHI()) { ++MI; continue; } diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index 043ea20..f6c53f3 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -1320,7 +1320,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP, if (!definesFullReg(*DefMI, SrcReg)) return false; bool SawStore = false; - if (!DefMI->isSafeToMove(AA, SawStore)) + if (!DefMI->isSafeToMove(SawStore)) return false; const MCInstrDesc &MCID = DefMI->getDesc(); if (MCID.getNumDefs() != 1) diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index 6f7905c..fb6274b 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -948,7 +948,7 @@ bool TwoAddressInstructionImpl::rescheduleMIBelowKill( return false; bool SeenStore = true; - if (!MI->isSafeToMove(AA, SeenStore)) + if (!MI->isSafeToMove(SeenStore)) return false; if (TII->getInstrLatency(InstrItins, *MI) > 1) @@ -1131,7 +1131,7 @@ bool TwoAddressInstructionImpl::rescheduleKillAboveMI( return false; bool SeenStore = true; - if (!KillMI->isSafeToMove(AA, SeenStore)) + if (!KillMI->isSafeToMove(SeenStore)) return false; SmallVector<Register, 2> Uses; diff --git a/llvm/lib/Target/AArch64/AArch64ConditionalCompares.cpp b/llvm/lib/Target/AArch64/AArch64ConditionalCompares.cpp index fc4d05c..49e5211 100644 --- a/llvm/lib/Target/AArch64/AArch64ConditionalCompares.cpp +++ b/llvm/lib/Target/AArch64/AArch64ConditionalCompares.cpp @@ -416,7 +416,7 @@ bool SSACCmpConv::canSpeculateInstrs(MachineBasicBlock *MBB, // We never speculate stores, so an AA pointer isn't necessary. bool DontMoveAcrossStore = true; - if (!I.isSafeToMove(nullptr, DontMoveAcrossStore)) { + if (!I.isSafeToMove(DontMoveAcrossStore)) { LLVM_DEBUG(dbgs() << "Can't speculate: " << I); return false; } diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp index 18cb516..3b9195b 100644 --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -2311,7 +2311,7 @@ ARMBaseInstrInfo::canFoldIntoMOVCC(Register Reg, const MachineRegisterInfo &MRI, return nullptr; } bool DontMoveAcrossStores = true; - if (!MI->isSafeToMove(/* AliasAnalysis = */ nullptr, DontMoveAcrossStores)) + if (!MI->isSafeToMove(DontMoveAcrossStores)) return nullptr; return MI; } diff --git a/llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp b/llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp index 6926b02..1922675 100644 --- a/llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp +++ b/llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp @@ -1037,7 +1037,7 @@ bool DeadCodeElimination::runOnNode(MachineDomTreeNode *N) { if (MI->isInlineAsm()) continue; // Delete PHIs if possible. - if (!MI->isPHI() && !MI->isSafeToMove(nullptr, Store)) + if (!MI->isPHI() && !MI->isSafeToMove(Store)) continue; bool AllDead = true; diff --git a/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp b/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp index 8840c27..5e52cf0 100644 --- a/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp +++ b/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp @@ -1451,7 +1451,7 @@ bool HexagonGenInsert::removeDeadCode(MachineDomTreeNode *N) { Opc == TargetOpcode::LIFETIME_END) continue; bool Store = false; - if (MI->isInlineAsm() || !MI->isSafeToMove(nullptr, Store)) + if (MI->isInlineAsm() || !MI->isSafeToMove(Store)) continue; bool AllDead = true; diff --git a/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp b/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp index b8a3743..9f3d9b7 100644 --- a/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp +++ b/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp @@ -483,7 +483,7 @@ static MachineInstr *canFoldIntoSelect(Register Reg, return nullptr; } bool DontMoveAcrossStores = true; - if (!MI->isSafeToMove(/*AliasAnalysis=*/nullptr, DontMoveAcrossStores)) + if (!MI->isSafeToMove(DontMoveAcrossStores)) return nullptr; return MI; } diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index 1df51c1..0620c3f 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -1365,7 +1365,7 @@ static MachineInstr *canFoldAsPredicatedOp(Register Reg, return nullptr; } bool DontMoveAcrossStores = true; - if (!MI->isSafeToMove(/* AliasAnalysis = */ nullptr, DontMoveAcrossStores)) + if (!MI->isSafeToMove(DontMoveAcrossStores)) return nullptr; return MI; } diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp index 16bbfd4..d075889 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -631,8 +631,7 @@ MachineInstr *SystemZInstrInfo::optimizeLoadInstr(MachineInstr &MI, DefMI = MRI->getVRegDef(FoldAsLoadDefReg); assert(DefMI); bool SawStore = false; - if (!DefMI->isSafeToMove(nullptr, SawStore) || - !MRI->hasOneNonDBGUse(FoldAsLoadDefReg)) + if (!DefMI->isSafeToMove(SawStore) || !MRI->hasOneNonDBGUse(FoldAsLoadDefReg)) return nullptr; int UseOpIdx = diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index f3e6aaf..918a608 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -5588,7 +5588,7 @@ MachineInstr *X86InstrInfo::optimizeLoadInstr(MachineInstr &MI, DefMI = MRI->getVRegDef(FoldAsLoadDefReg); assert(DefMI); bool SawStore = false; - if (!DefMI->isSafeToMove(nullptr, SawStore)) + if (!DefMI->isSafeToMove(SawStore)) return nullptr; // Collect information about virtual register operands of MI. |