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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 24 06:05:51 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);
----------------
arsenm wrote:

Why do we have this pre-scan over the entire function in the first place? Why doesn't it just look at the current instruction like every other hazard recognizer? I also find this logic suspect, what happens with external calls or asm? Can we delete this whole thing? 

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


More information about the llvm-commits mailing list