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

Mehdi Amini llvmlistbot at llvm.org
Thu Jan 18 08:28:11 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:

That is since C++11 you can replace:
```
void foo() {
  static llvm::once_flag initializeOnce;
  llvm::call_once(initializeOnce, []() { .... });
  ...
```

with:

That is since C++11 you can replace:
```
void foo() {
  static bool initOnce = []() { .... ; return true; }();
  ...
```


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


More information about the Mlir-commits mailing list