[clang] [CIR] Lower variadic arguments through an indirect call (PR #227477)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 29 14:58:21 PDT 2026


================
@@ -971,8 +979,9 @@ static void prependIndirectCallee(cir::CallOp call,
   // rebuilt pointee is what makes the lowered call variadic, and only a
   // variadic call gets the vector-register count that the x86_64 SysV ABI
   // passes in AL and that the callee's va_arg reads back.
-  auto calleeFnTy = cast<cir::FuncType>(
-      cast<cir::PointerType>(calleePtr.getType()).getPointee());
+  cir::FuncType calleeFnTy = getIndirectCalleeType(call);
+  assert((calleeFnTy.isVarArg() || numEllipsisArgs == 0) &&
----------------
andykaylor wrote:

Should you also assert that calleeFnTy isn't null before you do this?

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


More information about the cfe-commits mailing list