[Mlir-commits] [mlir] [MLIR] Add optimization attrs for gpu-to-llvmspv function declarations (PR #99301)

Victor Perez llvmlistbot at llvm.org
Wed Jul 17 03:52:26 PDT 2024


================
@@ -53,6 +52,17 @@ static LLVM::LLVMFuncOp lookupOrCreateSPIRVFn(Operation *symbolTable,
         symbolTable->getLoc(), name,
         LLVM::LLVMFunctionType::get(resultType, paramTypes));
     func.setCConv(LLVM::cconv::CConv::SPIR_FUNC);
+    func.setNoUnwind(true);
+    func.setWillReturn(true);
+    if (!hasMemoryEffects) {
+      // no externally observable effects
+      constexpr auto noModRef = mlir::LLVM::ModRefInfo::NoModRef;
+      auto memAttr = b.getAttr<LLVM::MemoryEffectsAttr>(
+          /*other*/ noModRef,
+          /*argMem*/ noModRef, /*inaccessibleMem*/ noModRef);
----------------
victor-eds wrote:

```suggestion
          /*other=*/noModRef,
          /*argMem=*/noModRef, /*inaccessibleMem=*/noModRef);
```

Consistency. Applies to other cases.

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


More information about the Mlir-commits mailing list