[llvm] [AMDGPU] Consider FLAT instructions for VMEM hazard detection (PR #137170)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 24 07:17:08 PDT 2025


================
@@ -1424,9 +1424,9 @@ static bool shouldRunLdsBranchVmemWARHazardFixup(const MachineFunction &MF,
   bool HasVmem = false;
   for (auto &MBB : MF) {
     for (auto &MI : MBB) {
-      HasLds |= SIInstrInfo::isDS(MI);
-      HasVmem |=
-          SIInstrInfo::isVMEM(MI) || SIInstrInfo::isSegmentSpecificFLAT(MI);
+      HasLds |= SIInstrInfo::isDS(MI) || SIInstrInfo::isLDSDMA(MI);
+      HasVmem |= (SIInstrInfo::isVMEM(MI) || SIInstrInfo::isFLAT(MI)) &&
+                 !SIInstrInfo::isLDSDMA(MI);
----------------
jayfoad wrote:

What's unique about this one is that the HazardFn passed into getWaitStatesSince contains a recursive call to getWaitStatesSince, which can make it ridiculously expensive.

https://github.com/llvm/llvm-project/pull/137170


More information about the llvm-commits mailing list