[Mlir-commits] [mlir] merge code for llvm.emit_c_interface into convertFuncOpToLLVMFuncOp (PR #92986)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 22 06:23:24 PDT 2024


fengxie wrote:

> Thanks for the patch! I suppose this is the case of "nobody needed this yet".
> 
> Can we do one step further and actually generalize this function to be usable without conversion patterns? It can take a `RewriterBase &` instead of `ConversionPatternRewriter` as far as I can see. Then it becomes usable standalone and the test can be simplified to actually test the function and not the function + conversion infra.

I actually started with `RewriterBase &`. But `RewriterBase` doesn't have `inlineRegionBefore` and `convertRegionTypes`. I prefer `RewriterBase &` if it works. Do you have suggestion on it?

```c++
  rewriter.inlineRegionBefore(funcOp.getFunctionBody(), newFuncOp.getBody(),
                              newFuncOp.end());
  if (failed(rewriter.convertRegionTypes(&newFuncOp.getBody(), converter,
                                         &result))) {
    return rewriter.notifyMatchFailure(funcOp,
                                       "region types conversion failed");
  }
```

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


More information about the Mlir-commits mailing list