[llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 19:44:57 PDT 2024


================
@@ -433,6 +433,19 @@ struct AAAMDAttributesFunction : public AAAMDAttributes {
       indicatePessimisticFixpoint();
       return;
     }
+
+    bool HasAllocaOrASCast = false;
+    for (BasicBlock &BB : *F) {
+      for (Instruction &I : BB) {
+        if (isa<AllocaInst>(I) || isa<AddrSpaceCastInst>(I)) {
+          HasAllocaOrASCast = true;
+          removeAssumedBits(FLAT_SCRATCH_INIT);
+          break;
+        }
+      }
+      if (HasAllocaOrASCast)
+        break;
+    }
----------------
jdoerfert wrote:

At some point, you need to look at the non-call instructions.
It makes sense to do that in update *if* we ever do value simplification or dead code elimination as part of the pass. Otherwise, init is fine, I think.


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


More information about the llvm-commits mailing list