Skip to content

Commit 49cad2d

Browse files
author
Jun Wang
committed
With llvm#87539, previous commit that checks for the instruction immediately
after a load/store is not necessary.
1 parent 4ae38b6 commit 49cad2d

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,15 +2306,11 @@ bool SIInsertWaitcnts::insertWaitcntInBlock(MachineFunction &MF,
23062306
#endif
23072307

23082308
if (ST->isPreciseMemoryEnabled() && Inst.mayLoadOrStore()) {
2309-
++Iter;
2310-
if (!isWaitInstr(*Iter)) {
2311-
AMDGPU::Waitcnt Wait = WCG->getAllZeroWaitcnt(
2312-
Inst.mayStore() && !SIInstrInfo::isAtomicRet(Inst));
2313-
ScoreBrackets.simplifyWaitcnt(Wait);
2314-
Modified |= generateWaitcnt(Wait, std::next(Inst.getIterator()), Block,
2315-
ScoreBrackets, /*OldWaitcntInstr=*/nullptr);
2316-
}
2317-
--Iter;
2309+
AMDGPU::Waitcnt Wait = WCG->getAllZeroWaitcnt(
2310+
Inst.mayStore() && !SIInstrInfo::isAtomicRet(Inst));
2311+
ScoreBrackets.simplifyWaitcnt(Wait);
2312+
Modified |= generateWaitcnt(Wait, std::next(Inst.getIterator()), Block,
2313+
ScoreBrackets, /*OldWaitcntInstr=*/nullptr);
23182314
}
23192315

23202316
LLVM_DEBUG({

llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,11 +2484,10 @@ bool SIMemoryLegalizer::expandLoad(const SIMemOpInfo &MOI,
24842484
// Atomic instructions already bypass caches to the scope specified by the
24852485
// SyncScope operand. Only non-atomic volatile and nontemporal/last-use
24862486
// instructions need additional treatment.
2487-
// SyncScope operand. Only non-atomic volatile and nontemporal instructions
2488-
// need additional treatment.
2489-
Changed |= CC->enableVolatileAndOrNonTemporal(MI, MOI.getInstrAddrSpace(),
2490-
SIMemOp::LOAD, MOI.isVolatile(),
2491-
MOI.isNonTemporal());
2487+
Changed |= CC->enableVolatileAndOrNonTemporal(
2488+
MI, MOI.getInstrAddrSpace(), SIMemOp::LOAD, MOI.isVolatile(),
2489+
MOI.isNonTemporal(), MOI.isLastUse());
2490+
24922491
return Changed;
24932492
}
24942493

0 commit comments

Comments
 (0)