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

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 06:49:37 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;
----------------
steffenlarsen wrote:

Nit; No point in setting the value first and then overwriting it, when we have the argument available.

```suggestion
    return ArgClassification::getDirect(coerced, /*Offset=*/0,
                                        /*Align=*/std::nullopt,
                                        info.getCanBeFlattened());
```

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


More information about the cfe-commits mailing list