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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jul 17 07:47:49 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);
----------------
FMarno wrote:

good one, my editor actually recognizes this format too which is useful.

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


More information about the Mlir-commits mailing list