[clang] [llvm] [ABI] Add CanBeFlattened to ArgInfo for Direct struct coerces (PR #220579)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 23:47:58 PDT 2026


================
@@ -542,7 +543,9 @@ convertABIArgInfo(const llvm::abi::ArgInfo &info, MLIRContext *ctx,
     // trip for nothing.
     if (comparesAgainstCoerce && coerced == origTy)
       return ArgClassification::getDirect(nullptr);
-    return ArgClassification::getDirect(coerced);
+    ArgClassification classified = ArgClassification::getDirect(coerced);
+    classified.canFlatten = info.getCanBeFlattened();
+    return classified;
----------------
skc7 wrote:

Thanks for the suggestion @steffenlarsen.
The suggested overload is `llvm::abi::ArgInfo::getDirect`  and this call site builds an `mlir::abi::ArgClassification`, whose `getDirect` https://github.com/llvm/llvm-project/blob/011005fecf846e40dad1941f6cbbd6653ae37460/mlir/include/mlir/ABI/ABIRewriteContext.h#L93 only takes (`Type coerced`) and has no other fields. To get the same effect, `Offset/Align/CanFlatten` fields need to be added in mlir `ABIRewriteContext.h`.

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


More information about the cfe-commits mailing list