[clang] 328836b - [CIR][ABI] Honor abi::ArgInfo::CanBeFlattened in the call-conv lowering (#220579)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 20 21:11:53 PDT 2026
Author: Chaitanya
Date: 2026-09-21T09:41:47+05:30
New Revision: 328836b340124fc45e8529d64bbd11d1de03d228
URL: https://github.com/llvm/llvm-project/commit/328836b340124fc45e8529d64bbd11d1de03d228
DIFF: https://github.com/llvm/llvm-project/commit/328836b340124fc45e8529d64bbd11d1de03d228.diff
LOG: [CIR][ABI] Honor abi::ArgInfo::CanBeFlattened in the call-conv lowering (#220579)
**Summary:**
- CanBeFlattened landed on abi::ArgInfo in main
(llvm/llvm-project#220558).
- Consume the abi::ArgInfo::CanBeFlattened flag in the CIR
call-convention lowering bridge.
Assisted by: Claude Opus 4.8
Added:
Modified:
clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
Removed:
################################################################################
diff --git a/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp b/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
index 93abc53802d63..f7da35904dd63 100644
--- a/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
@@ -549,9 +549,10 @@ static const llvm::abi::Type *mapCIRType(mlir::Type type,
/// unpacked into the register(s) holding it, a scalar too wide for one register
/// split into a tuple of them, a scalar the classifier widens to fill its
/// eightbyte, and a value whose live bytes start partway into its storage
-/// because a leading eightbyte holds no field (getDirectOffset). getDirect
-/// keeps canFlatten set so the rewriter can split a multi-field coerced
-/// struct into individual wire arguments. Any other scalar passes in its
+/// because a leading eightbyte holds no field (getDirectOffset). canFlatten
+/// follows the classifier's CanBeFlattened, so the rewriter splits a
+/// multi-field coerced struct into individual wire arguments unless the
+/// classifier asked to keep it intact. Any other scalar passes in its
/// natural CIR type, which a null coercion denotes. A coercion this bridge
/// cannot represent yields std::nullopt so the caller reports NYI rather than
/// silently passing the value unchanged.
@@ -612,7 +613,10 @@ convertABIArgInfo(const llvm::abi::ArgInfo &info, MLIRContext *ctx,
// trip for nothing.
if (comparesAgainstCoerce && coerced == origTy)
return ArgClassification::getDirect();
- return ArgClassification::getDirect(coerced, offset);
+ ArgClassification classified =
+ ArgClassification::getDirect(coerced, offset);
+ classified.canFlatten = info.getCanBeFlattened();
+ return classified;
}
// An extended value is always read from byte 0 of its own storage, so
// there is no offset to honor here.
More information about the cfe-commits
mailing list