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

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 09:54:56 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());
----------------
Fznamznon wrote:

Do you mean I should apply `RValue::get()` in `CodeGenFunction::EmitVAArg`? And all the callers of `EmitVAAArg` therefore should do `getScalarVal()` or similar to get a `llvm::value`?
Or is it still better to do in another PR?
If I revert the current change with `EmitLoadOfScalar` there should be a manipulation for _BitInt like it was in first version of the patch and received this comment - https://github.com/llvm/llvm-project/pull/91364#discussion_r1592864982 .

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


More information about the cfe-commits mailing list