[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 11:41:46 PDT 2024


================
@@ -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:

For reference, this is basically deleting the `ArgTy != Val->getType()` branch without any replacement.  But the Mips case where that was relevant got fixed a different way in 7f416cc4 , so I think it's dead code anyway.

Maybe worth splitting this into a separate pull request, though, in case it causes an issue for some other target.

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


More information about the cfe-commits mailing list