[PATCH] D44514: [MSan] Don't create zero offsets in getShadowPtrForArgument(). NFC

Alexander Potapenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 19 03:06:35 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL327829: [MSan] Don't create zero offsets in getShadowPtrForArgument(). NFC (authored by glider, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44514?vs=138553&id=138886#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44514

Files:
  llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp


Index: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1094,7 +1094,8 @@
   Value *getShadowPtrForArgument(Value *A, IRBuilder<> &IRB,
                                  int ArgOffset) {
     Value *Base = IRB.CreatePointerCast(MS.ParamTLS, MS.IntptrTy);
-    Base = IRB.CreateAdd(Base, ConstantInt::get(MS.IntptrTy, ArgOffset));
+    if (ArgOffset)
+      Base = IRB.CreateAdd(Base, ConstantInt::get(MS.IntptrTy, ArgOffset));
     return IRB.CreateIntToPtr(Base, PointerType::get(getShadowTy(A), 0),
                               "_msarg");
   }
@@ -1104,7 +1105,8 @@
                                  int ArgOffset) {
     if (!MS.TrackOrigins) return nullptr;
     Value *Base = IRB.CreatePointerCast(MS.ParamOriginTLS, MS.IntptrTy);
-    Base = IRB.CreateAdd(Base, ConstantInt::get(MS.IntptrTy, ArgOffset));
+    if (ArgOffset)
+      Base = IRB.CreateAdd(Base, ConstantInt::get(MS.IntptrTy, ArgOffset));
     return IRB.CreateIntToPtr(Base, PointerType::get(MS.OriginTy, 0),
                               "_msarg_o");
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44514.138886.patch
Type: text/x-patch
Size: 1247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180319/f3a871e9/attachment.bin>


More information about the llvm-commits mailing list