Skip to content

Commit de4349b

Browse files
committed
[CIR][NFC] Fix regression by llvm#153819
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.
1 parent da45b6c commit de4349b

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)