[clang] [CIR] Accept _Complex and all float formats in x86_64 callconv lowering (PR #215117)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 10:02:44 PDT 2026
================
@@ -330,15 +346,19 @@ convertABIArgInfo(const llvm::abi::ArgInfo &info, MLIRContext *ctx,
bool coerceWidensScalar =
origInt && coerceInt &&
coerceInt->getSizeInBits().getFixedValue() > origInt.getWidth();
- if (!isAggregate && !coerceIsRegisterTuple && !coerceWidensScalar)
+ // Leaving the rest alone also avoids a lossy round trip: abiTypeToCIR
+ // drops the LongDoubleType wrapper and a pointer's pointee, so comparing a
+ // scalar against its own coerce would report a difference that is not one.
+ if (!isAggregate && !comparesAgainstCoerce && !coerceIsRegisterTuple &&
+ !coerceWidensScalar)
return ArgClassification::getDirect(nullptr);
- // The coerce must be a type this bridge can represent. One it cannot map
- // (an SSE vector, or a nested type it does not handle) yields a null type.
- // Report that as NYI instead of leaving the value as an unchanged by-value
- // record.
mlir::Type coerced = abiTypeToCIR(coerceAbi, ctx);
if (!coerced)
return std::nullopt;
+ // Coercing a value to the type it already has would add a memory round
+ // trip for nothing.
+ if (comparesAgainstCoerce && coerced == origTy)
----------------
andykaylor wrote:
Is `comparesAgainstCoerce` really necessary here? Are there cases where `coerced == origTy` that we don't want to do this?
https://github.com/llvm/llvm-project/pull/215117
More information about the cfe-commits
mailing list