[Mlir-commits] [mlir] [mlir][LLVM] `FuncToLLVM`: Add 1:N type conversion support (PR #153823)
Tobias Gysi
llvmlistbot at llvm.org
Fri Aug 15 13:05:10 PDT 2025
================
@@ -565,34 +567,60 @@ struct CallOpInterfaceLowering : public ConvertOpToLLVMPattern<CallOpType> {
static_cast<int32_t>(promoted.size()), 0};
newOp.getProperties().op_bundle_sizes = rewriter.getDenseI32ArrayAttr({});
- SmallVector<Value, 4> results;
- if (numResults < 2) {
- // If < 2 results, packing did not do anything and we can just return.
- results.append(newOp.result_begin(), newOp.result_end());
- } else {
- // Otherwise, it had been converted to an operation producing a structure.
- // Extract individual results from the structure and return them as list.
- results.reserve(numResults);
- for (unsigned i = 0; i < numResults; ++i) {
- results.push_back(LLVM::ExtractValueOp::create(
- rewriter, callOp.getLoc(), newOp->getResult(0), i));
+ // Helper function that extracts an individual result from the return value
+ // of the new call op. llvm.call ops support only 0 or 1 result. In case of
+ // 2 or more results, the results are packed into a structure.
----------------
gysit wrote:
```suggestion
// 2 or more results, the results are packed into a structure.
```
maybe it is worth explaining that the type conversion can also lead to multiple results? I assume that is the reason why we cannot keep using numResults as before.
https://github.com/llvm/llvm-project/pull/153823
More information about the Mlir-commits
mailing list