Skip to content

Commit c5c935a

Browse files
committed
Make more use of MachineInstr::mayLoadOrStore.
1 parent bbcf1c3 commit c5c935a

14 files changed

+20
-20
lines changed

llvm/include/llvm/CodeGen/TargetInstrInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,9 +1647,9 @@ class TargetInstrInfo : public MCInstrInfo {
16471647
virtual bool
16481648
areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
16491649
const MachineInstr &MIb) const {
1650-
assert((MIa.mayLoad() || MIa.mayStore()) &&
1650+
assert(MIa.mayLoadOrStore() &&
16511651
"MIa must load from or modify a memory location");
1652-
assert((MIb.mayLoad() || MIb.mayStore()) &&
1652+
assert(MIb.mayLoadOrStore() &&
16531653
"MIb must load from or modify a memory location");
16541654
return false;
16551655
}

llvm/lib/CodeGen/BranchFolding.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ static unsigned EstimateRuntime(MachineBasicBlock::iterator I,
449449
continue;
450450
if (I->isCall())
451451
Time += 10;
452-
else if (I->mayLoad() || I->mayStore())
452+
else if (I->mayLoadOrStore())
453453
Time += 2;
454454
else
455455
++Time;
@@ -835,7 +835,7 @@ mergeOperations(MachineBasicBlock::iterator MBBIStartPos,
835835
assert(MBBICommon->isIdenticalTo(*MBBI) && "Expected matching MIIs!");
836836

837837
// Merge MMOs from memory operations in the common block.
838-
if (MBBICommon->mayLoad() || MBBICommon->mayStore())
838+
if (MBBICommon->mayLoadOrStore())
839839
MBBICommon->cloneMergedMemRefs(*MBB->getParent(), {&*MBBICommon, &*MBBI});
840840
// Drop undef flags if they aren't present in all merged instructions.
841841
for (unsigned I = 0, E = MBBICommon->getNumOperands(); I != E; ++I) {

llvm/lib/CodeGen/ImplicitNullChecks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ ImplicitNullChecks::isSuitableMemoryOp(const MachineInstr &MI,
372372

373373
// We want the mem access to be issued at a sane offset from PointerReg,
374374
// so that if PointerReg is null then the access reliably page faults.
375-
if (!((MI.mayLoad() || MI.mayStore()) && !MI.isPredicable() &&
375+
if (!(MI.mayLoadOrStore() && !MI.isPredicable() &&
376376
-PageSize < Offset && Offset < PageSize))
377377
return SR_Unsuitable;
378378

llvm/lib/CodeGen/StackColoring.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
10041004
// zone are okay, despite the fact that we don't have a good way
10051005
// for validating all of the usages of the calculation.
10061006
#ifndef NDEBUG
1007-
bool TouchesMemory = I.mayLoad() || I.mayStore();
1007+
bool TouchesMemory = I.mayLoadOrStore();
10081008
// If we *don't* protect the user from escaped allocas, don't bother
10091009
// validating the instructions.
10101010
if (!I.isDebugInstr() && TouchesMemory && ProtectFromEscapedAllocas) {

llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ GCNHazardRecognizer::getHazardType(SUnit *SU, int Stalls) {
185185
if (SIInstrInfo::isMAI(*MI) && checkMAIHazards(MI) > 0)
186186
return NoopHazard;
187187

188-
if ((MI->mayLoad() || MI->mayStore()) && checkMAILdStHazards(MI) > 0)
188+
if (MI->mayLoadOrStore() && checkMAILdStHazards(MI) > 0)
189189
return NoopHazard;
190190

191191
if (MI->isInlineAsm() && checkInlineAsmHazards(MI) > 0)
@@ -296,7 +296,7 @@ unsigned GCNHazardRecognizer::PreEmitNoopsCommon(MachineInstr *MI) {
296296
if (SIInstrInfo::isMAI(*MI))
297297
return std::max(WaitStates, checkMAIHazards(MI));
298298

299-
if (MI->mayLoad() || MI->mayStore())
299+
if (MI->mayLoadOrStore())
300300
return std::max(WaitStates, checkMAILdStHazards(MI));
301301

302302
return WaitStates;

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ void SIInsertWaitcnts::updateEventWaitcntAfter(MachineInstr &Inst,
12111211
ScoreBrackets->updateByEvent(TII, TRI, MRI, LDS_ACCESS, Inst);
12121212
}
12131213
} else if (TII->isFLAT(Inst)) {
1214-
assert(Inst.mayLoad() || Inst.mayStore());
1214+
assert(Inst.mayLoadOrStore());
12151215

12161216
if (TII->usesVM_CNT(Inst)) {
12171217
if (!ST->hasVscnt())

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,9 +2549,9 @@ bool SIInstrInfo::checkInstOffsetsDoNotOverlap(const MachineInstr &MIa,
25492549

25502550
bool SIInstrInfo::areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
25512551
const MachineInstr &MIb) const {
2552-
assert((MIa.mayLoad() || MIa.mayStore()) &&
2552+
assert(MIa.mayLoadOrStore() &&
25532553
"MIa must load from or modify a memory location");
2554-
assert((MIb.mayLoad() || MIb.mayStore()) &&
2554+
assert(MIb.mayLoadOrStore() &&
25552555
"MIb must load from or modify a memory location");
25562556

25572557
if (MIa.hasUnmodeledSideEffects() || MIb.hasUnmodeledSideEffects())

llvm/lib/Target/ARC/ARCOptAddrMode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ bool ARCOptAddrMode::noUseOfAddBeforeLoadOrStore(const MachineInstr *Add,
186186
}
187187

188188
MachineInstr *ARCOptAddrMode::tryToCombine(MachineInstr &Ldst) {
189-
assert((Ldst.mayLoad() || Ldst.mayStore()) && "LD/ST instruction expected");
189+
assert(Ldst.mayLoadOrStore() && "LD/ST instruction expected");
190190

191191
unsigned BasePos, OffsetPos;
192192

llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,7 @@ bool HCE::replaceInstrExact(const ExtDesc &ED, Register ExtR) {
16391639
return true;
16401640
}
16411641

1642-
if ((MI.mayLoad() || MI.mayStore()) && !isStoreImmediate(ExtOpc)) {
1642+
if (MI.mayLoadOrStore() && !isStoreImmediate(ExtOpc)) {
16431643
// For memory instructions, there is an asymmetry in the addressing
16441644
// modes. Addressing modes allowing extenders can be replaced with
16451645
// addressing modes that use registers, but the order of operands
@@ -1794,7 +1794,7 @@ bool HCE::replaceInstrExpr(const ExtDesc &ED, const ExtenderInit &ExtI,
17941794
return true;
17951795
}
17961796

1797-
if (MI.mayLoad() || MI.mayStore()) {
1797+
if (MI.mayLoadOrStore()) {
17981798
unsigned IdxOpc = getRegOffOpcode(ExtOpc);
17991799
assert(IdxOpc && "Expecting indexed opcode");
18001800
MachineInstrBuilder MIB = BuildMI(MBB, At, dl, HII->get(IdxOpc));
@@ -1844,7 +1844,7 @@ bool HCE::replaceInstr(unsigned Idx, Register ExtR, const ExtenderInit &ExtI) {
18441844
// These two addressing modes must be converted into indexed forms
18451845
// regardless of what the initializer looks like.
18461846
bool IsAbs = false, IsAbsSet = false;
1847-
if (MI.mayLoad() || MI.mayStore()) {
1847+
if (MI.mayLoadOrStore()) {
18481848
unsigned AM = HII->getAddrMode(MI);
18491849
IsAbs = AM == HexagonII::Absolute;
18501850
IsAbsSet = AM == HexagonII::AbsoluteSet;

llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ bool HexagonEarlyIfConversion::isPredicableStore(const MachineInstr *MI)
682682

683683
bool HexagonEarlyIfConversion::isSafeToSpeculate(const MachineInstr *MI)
684684
const {
685-
if (MI->mayLoad() || MI->mayStore())
685+
if (MI->mayLoadOrStore())
686686
return false;
687687
if (MI->isCall() || MI->isBarrier() || MI->isBranch())
688688
return false;

llvm/lib/Target/Hexagon/HexagonExpandCondsets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ bool HexagonExpandCondsets::predicate(MachineInstr &TfrI, bool Cond,
10411041
bool CanDown = canMoveOver(*DefI, Defs, Uses);
10421042
// The TfrI does not access memory, but DefI could. Check if it's safe
10431043
// to move DefI down to TfrI.
1044-
if (DefI->mayLoad() || DefI->mayStore())
1044+
if (DefI->mayLoadOrStore())
10451045
if (!canMoveMemTo(*DefI, TfrI, true))
10461046
CanDown = false;
10471047

llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@ bool HexagonInstrInfo::isDuplexPair(const MachineInstr &MIa,
21472147
}
21482148

21492149
bool HexagonInstrInfo::isEarlySourceInstr(const MachineInstr &MI) const {
2150-
if (MI.mayLoad() || MI.mayStore() || MI.isCompare())
2150+
if (MI.mayLoadOrStore() || MI.isCompare())
21512151
return true;
21522152

21532153
// Multiply

llvm/lib/Target/Hexagon/HexagonSplitDouble.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ bool HexagonSplitDoubleRegs::isVolatileInstr(const MachineInstr *MI) const {
159159
}
160160

161161
bool HexagonSplitDoubleRegs::isFixedInstr(const MachineInstr *MI) const {
162-
if (MI->mayLoad() || MI->mayStore())
162+
if (MI->mayLoadOrStore())
163163
if (MemRefsFixed || isVolatileInstr(MI))
164164
return true;
165165
if (MI->isDebugInstr())

llvm/lib/Target/Hexagon/HexagonStoreWidening.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ void HexagonStoreWidening::createStoreGroup(MachineInstr *BaseStore,
271271
if (MI->isCall() || MI->hasUnmodeledSideEffects())
272272
return;
273273

274-
if (MI->mayLoad() || MI->mayStore()) {
274+
if (MI->mayLoadOrStore()) {
275275
if (MI->hasOrderedMemoryRef() || instrAliased(Group, MI))
276276
return;
277277
Other.push_back(MI);

0 commit comments

Comments
 (0)