[clang] [CIR][NFC] Fix regression by #153819 (PR #154346)

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 19 07:24:34 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Sirui Mu (Lancern)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/154346.diff


1 Files Affected:

- (modified) clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp (+5-4) 


``````````diff
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 {};
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/154346


More information about the cfe-commits mailing list