Author: Sirui Mu Date: 2025-08-19T23:32:02+08:00 New Revision: 10d193bf5eb92fda020e3d7304b5b1da6d5d4c1e
URL: https://github.com/llvm/llvm-project/commit/10d193bf5eb92fda020e3d7304b5b1da6d5d4c1e DIFF: https://github.com/llvm/llvm-project/commit/10d193bf5eb92fda020e3d7304b5b1da6d5d4c1e.diff LOG: [CIR][NFC] Fix regression by #153819 (#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. It's a bit strange that the pre-merge checks did not catch this. The tests failed on my local machine, which runs Fedora 42 with gcc 15.2.1 . Added: Modified: clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp Removed: ################################################################################ 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