[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:27 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);
+      func.setMemoryAttr(memAttr);
+    }
----------------
victor-eds wrote:

I'd rename `hasMemoryEffects` to `isMemNone`. It's weird not to do anything with `hasMemoryEffects` otherwise.

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


More information about the Mlir-commits mailing list