https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/154346
This patch fixes a regression introduced by #153819. The evaluation order of the arguments to `emitVAStart` is unspecified, but the test requires the arguments to be evaluated in left-to-right order. >From de4349b2e6dcecceaa2c882ca7907a963955262f Mon Sep 17 00:00:00 2001 From: Sirui Mu <msrlanc...@gmail.com> Date: Tue, 19 Aug 2025 22:19:52 +0800 Subject: [PATCH] [CIR][NFC] Fix regression by #153819 This patch fixes a regression introduced by #153819. The evaluation order of the arguments to `emitVAStart` is unspecified, but the test requires the arguments to be evaluated in left-to-right order. --- clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp index 1635756143f55..084fc5ccb19f8 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp @@ -129,10 +129,11 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID, case Builtin::BI__builtin_stdarg_start: case Builtin::BI__builtin_va_start: case Builtin::BI__va_start: { - emitVAStart(builtinID == Builtin::BI__va_start - ? emitScalarExpr(e->getArg(0)) - : emitVAListRef(e->getArg(0)).getPointer(), - emitScalarExpr(e->getArg(1))); + mlir::Value vaList = builtinID == Builtin::BI__va_start + ? emitScalarExpr(e->getArg(0)) + : emitVAListRef(e->getArg(0)).getPointer(); + mlir::Value count = emitScalarExpr(e->getArg(1)); + emitVAStart(vaList, count); return {}; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits