[llvm] [MemorySanitizer] Use getelementptr instead of ptrtoint+add+inttoptr (PR #161392)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 01:16:30 PDT 2025


================
@@ -7219,9 +7219,10 @@ struct VarArgHelperBase : public VarArgHelper {
 
   /// Compute the shadow address for a given va_arg.
   Value *getShadowPtrForVAArgument(IRBuilder<> &IRB, unsigned ArgOffset) {
-    Value *Base = IRB.CreatePointerCast(MS.VAArgTLS, MS.IntptrTy);
-    Base = IRB.CreateAdd(Base, ConstantInt::get(MS.IntptrTy, ArgOffset));
-    return IRB.CreateIntToPtr(Base, MS.PtrTy, "_msarg_va_s");
----------------
nikic wrote:

I've restored the names, though in most cases these will be discarded (as the result is a constant expression). Makes a difference for kmsan though.

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


More information about the llvm-commits mailing list