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

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 01:01:45 PDT 2024


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

``static_cast`` is a C++ feature, but rarely used in LLVM code. Instead we use ``dyn_cast`` or ``cast``. You should be doing something like this:

`if (auto *AddrCastInst = dyn_cast<AddrSpaceCastInst>(&I)) { ... }`

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


More information about the llvm-commits mailing list