================ @@ -5348,18 +5348,8 @@ Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { return llvm::UndefValue::get(ArgTy); } - // FIXME Volatility. - llvm::Value *Val = Builder.CreateLoad(ArgPtr); - - // If EmitVAArg promoted the type, we must truncate it. - if (ArgTy != Val->getType()) { - if (ArgTy->isPointerTy() && !Val->getType()->isPointerTy()) - Val = Builder.CreateIntToPtr(Val, ArgTy); - else - Val = Builder.CreateTrunc(Val, ArgTy); - } - - return Val; + return CGF.EmitLoadOfScalar(ArgPtr, Ty.isVolatileQualified(), Ty, + VE->getExprLoc()); ---------------- efriedma-quic wrote:
> And all the callers of EmitVAAArg therefore should do getScalarVal() or > similar to get a llvm::value Yes, that's the idea. Should significantly simplify the code for some targets. This should be a dependent PR; we merge that first, then this PR doesn't need to touch the varargs code. https://github.com/llvm/llvm-project/pull/91364 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits