[Mlir-commits] [mlir] [MLIR][GPU-LLVM] Add in-pass signature update option for opencl kernels (PR #105664)
Jakub Kuderski
llvmlistbot at llvm.org
Wed Sep 11 07:12:51 PDT 2024
================
@@ -385,6 +385,19 @@ struct GPUToLLVMSPVConversionPass final
if (failed(applyPartialConversion(getOperation(), target,
std::move(patterns))))
signalPassFailure();
+
+ // `func.func`s are not handled by the lowering, so need a proper calling
+ // convention set separately.
+ getOperation().walk([&](LLVM::LLVMFuncOp f) {
+ if (f.getCConv() == LLVM::CConv::C) {
+ f.setCConv(LLVM::CConv::SPIR_FUNC);
+ }
+ });
+ getOperation().walk([&](LLVM::CallOp c) {
----------------
kuhar wrote:
I don't think these two lambdas capture anything?
```suggestion
getOperation().walk([](LLVM::LLVMFuncOp f) {
if (f.getCConv() == LLVM::CConv::C) {
f.setCConv(LLVM::CConv::SPIR_FUNC);
}
});
getOperation().walk([](LLVM::CallOp c) {
```
https://github.com/llvm/llvm-project/pull/105664
More information about the Mlir-commits
mailing list