[llvm] [AMDGPU][Attributor] Make `AAAMDFlatWorkGroupSize` honor existing attribute (PR #114357)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 14:45:17 PDT 2024


================
@@ -168,7 +168,15 @@ class AMDGPUInformationCache : public InformationCache {
     return ST.supportsGetDoorbellID();
   }
 
-  std::pair<unsigned, unsigned> getFlatWorkGroupSizes(const Function &F) {
+  std::optional<std::pair<unsigned, unsigned>>
+  getFlatWorkGroupSizeAttr(const Function &F) const {
+    Attribute A = F.getFnAttribute("amdgpu-flat-work-group-size");
+    if (!A.isStringAttribute())
+      return std::nullopt;
----------------
shiltian wrote:

> The presence or absence of an attribute should not impart meaning. A function explicitly marked with the default value should be the same as one with no attribute.

Give what the front end is doing, we will indeed discard the default attribute.

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


More information about the llvm-commits mailing list