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

Jun Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 12:01:21 PDT 2024


================
@@ -433,6 +433,13 @@ struct AAAMDAttributesFunction : public AAAMDAttributes {
       indicatePessimisticFixpoint();
       return;
     }
+
+    for (Instruction &I : instructions(F)) {
+      if (isa<AllocaInst>(I) || isa<AddrSpaceCastInst>(I)) {
----------------
jwanggit86 wrote:

> Approximately yes, but you should use dyn_cast and never static_cast

Doesn't the check `isa<AddrSpaceCastInst>(I)` already make sure that the instruction is a `AddrSpaceCastInst`?

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


More information about the llvm-commits mailing list