================
@@ -1519,7 +1519,13 @@ mlir::Value CIRGenFunction::emitVAArg(VAArgExpr *ve) {
assert(!cir::MissingFeatures::msabi());
assert(!cir::MissingFeatures::vlas());
mlir::Location loc = cgm.getLoc(ve->getExprLoc());
- mlir::Type type = convertType(ve->getType());
+ QualType qualType = ve->getType();
+ mlir::Type type = convertType(qualType);
+
+ // For aggregate types, va_arg returns a pointer to the aggregate.
+ if (qualType->isAggregateType())
+ type = cir::PointerType::get(type.getContext(), type);
----------------
andykaylor wrote:
This is not what we want here. The fact that this becomes a pointer with
aggregates is ABI-specific and for some targets depends on the size of the
structure.
https://godbolt.org/z/nnW4Kb85d
You won't get output that matches OGCG because we aren't handling the ABI
details yet. Since this is intending to capture the operation before ABI
handling (as noted in the comment above the function), I think the code here
was correct.
https://github.com/llvm/llvm-project/pull/172551
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits