Skip to content

Commit 10d193b

Browse files
authored
[CIR][NFC] Fix regression by llvm#153819 (llvm#154346)
This patch fixes a regression introduced by llvm#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 .
1 parent 6e3c7b8 commit 10d193b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
129129
case Builtin::BI__builtin_stdarg_start:
130130
case Builtin::BI__builtin_va_start:
131131
case Builtin::BI__va_start: {
132-
emitVAStart(builtinID == Builtin::BI__va_start
133-
? emitScalarExpr(e->getArg(0))
134-
: emitVAListRef(e->getArg(0)).getPointer(),
135-
emitScalarExpr(e->getArg(1)));
132+
mlir::Value vaList = builtinID == Builtin::BI__va_start
133+
? emitScalarExpr(e->getArg(0))
134+
: emitVAListRef(e->getArg(0)).getPointer();
135+
mlir::Value count = emitScalarExpr(e->getArg(1));
136+
emitVAStart(vaList, count);
136137
return {};
137138
}
138139

0 commit comments

Comments
 (0)