[Mlir-commits] [mlir] [mlir][nvvm]Add support for grid_constant attribute on LLVM function arguments (PR #78228)

Mehdi Amini llvmlistbot at llvm.org
Tue Jan 16 07:50:12 PST 2024


================
@@ -59,6 +59,19 @@ getAttrKindToNameMapping() {
   return kindNamePairs;
 }
 
+static llvm::DenseMap<llvm::StringRef, llvm::Attribute::AttrKind>
+getAttrNameToKindMapping() {
+  static auto attrNameToKindMapping = []() {
+    static llvm::DenseMap<llvm::StringRef, llvm::Attribute::AttrKind>
+        nameKindMap;
+    for (auto kindNamePair : getAttrKindToNameMapping()) {
+      nameKindMap.insert({kindNamePair.second, kindNamePair.first});
+    }
+    return nameKindMap;
+  }();
----------------
joker-eph wrote:

> I would rather have a static map that gets lazily populated on the first call.

Isn't this what's implemented here?

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


More information about the Mlir-commits mailing list