[Mlir-commits] [clang] [llvm] [mlir] [NVPTX] Canonicalize NVVM attribute strings and refactor property queries (NFC) (PR #187752)

Rajat Bajpai llvmlistbot at llvm.org
Sat Mar 21 00:14:58 PDT 2026


================
@@ -113,14 +127,13 @@ static std::optional<unsigned> findOneNVVMAnnotation(const GlobalValue *GV,
     cacheAnnotationFromMD(M, GV);
 
   auto &KVP = AC.Cache[M][GV];
-  auto It = KVP.find(Prop);
+  auto It = KVP.find(Prop.str());
   if (It == KVP.end())
     return std::nullopt;
   return It->second[0];
 }
 
-static bool findAllNVVMAnnotation(const GlobalValue *GV,
-                                  const std::string &Prop,
+static bool findAllNVVMAnnotation(const GlobalValue *GV, StringRef Prop,
----------------
rajatbajpai wrote:

nit: not related to this change.

The cache-lookup preamble in `findOneNVVMAnnotation` and `findAllNVVMAnnotation` is identical. We should consider extracting it into a shared helper that returns a pointer to the annotation vector (or nullptr), reducing both functions to thin wrappers.

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


More information about the Mlir-commits mailing list