[llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)
    Matt Arsenault via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Aug 19 06:50:24 PDT 2024
    
    
  
================
@@ -433,6 +433,13 @@ struct AAAMDAttributesFunction : public AAAMDAttributes {
       indicatePessimisticFixpoint();
       return;
     }
+
+    for (Instruction &I : instructions(F)) {
+      if (isa<AllocaInst>(I) || isa<AddrSpaceCastInst>(I)) {
----------------
arsenm wrote:
only addrspacecasts from address space 5 require flat_scr. Just an alloca does not imply flat_scr is required, only if the alloca is ever cast to flat. 
I suppose for robustness you could double check the alloca address space is correct 
https://github.com/llvm/llvm-project/pull/94647
    
    
More information about the llvm-commits
mailing list