[Mlir-commits] [mlir] [mlir][spirv] Add spirv-to-llvm conversion for OpControlBarrier (PR #111864)

Victor Perez llvmlistbot at llvm.org
Thu Oct 10 11:06:08 PDT 2024


================
@@ -1024,6 +1024,71 @@ class ReturnValuePattern : public SPIRVToLLVMConversion<spirv::ReturnValueOp> {
   }
 };
 
+static LLVM::LLVMFuncOp lookupOrCreateSPIRVFn(Operation *symbolTable,
+                                              StringRef name,
+                                              ArrayRef<Type> paramTypes,
+                                              Type resultType) {
+  auto func = dyn_cast_or_null<LLVM::LLVMFuncOp>(
+      SymbolTable::lookupSymbolIn(symbolTable, name));
+  if (!func) {
+    OpBuilder b(symbolTable->getRegion(0));
+    func = b.create<LLVM::LLVMFuncOp>(
+        symbolTable->getLoc(), name,
+        LLVM::LLVMFunctionType::get(resultType, paramTypes));
+    func.setCConv(LLVM::cconv::CConv::SPIR_FUNC);
+    func.setConvergent(true);
----------------
victor-eds wrote:

This isn't true for all SPIR-V functions. Should we move this somewhere else?


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


More information about the Mlir-commits mailing list