[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


================
@@ -677,6 +687,36 @@ struct AAAMDAttributesFunction : public AAAMDAttributes {
     return !A.checkForAllCallLikeInstructions(DoesNotRetrieve, *this,
                                               UsedAssumedInformation);
   }
+
+  // Returns true if FlatScratchInit is needed, i.e., no-flat-scratch-init is
+  // not to be set.
+  bool needFlatScratchInit(Attributor &A) {
+    assert(isAssumed(FLAT_SCRATCH_INIT)); // only called if the bit is still set
+
+    // This is called on each callee; false means callee shouldn't have
+    // no-flat-scratch-init.
+    auto CheckForNoFlatScratchInit = [&](Instruction &I) {
+      const auto &CB = cast<CallBase>(I);
+      const Function *Callee = CB.getCalledFunction();
+
+      if (Callee && Callee->isIntrinsic())
----------------
arsenm wrote:

Don't need to check isIntrinsic, getIntrinsicID will just be not_intrinsic for an arbitrary call 

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


More information about the llvm-commits mailing list