[PATCH] D53811: [MSan] another take at instrumenting inline assembly - now with calls

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 06:42:04 PDT 2018


dvyukov added a comment.

Otherwise looks good to me.



================
Comment at: lib/Transforms/Instrumentation/MemorySanitizer.cpp:3554
       Value *Operand = CI->getOperand(i);
-      Type *OpType = Operand->getType();
-      if (!OpType->isPointerTy())
-        continue;
-      Type *ElType = OpType->getPointerElementType();
-      if (!ElType->isSized())
-        continue;
-      Value *ShadowPtr, *OriginPtr;
-      std::tie(ShadowPtr, OriginPtr) = getShadowOriginPtr(
-          Operand, IRB, ElType, /*Alignment*/ 1, /*isStore*/ true);
-      Value *CShadow = getCleanShadow(ElType);
-      IRB.CreateStore(
-          CShadow,
-          IRB.CreatePointerCast(ShadowPtr, CShadow->getType()->getPointerTo()));
+      instrumentAsmArgument(Operand, I, IRB, DL, /*isOutput*/ true);
     }
----------------
After offline discussion, it's better to move stores _before_ the asm call because the asm call can publish some memory to other threads (also consistent with the way we instrument atomic ops).
But loads should precede stores because some args can be in/out.
After we move stores to before the call, we could combine the 2 loops, but it's unclear if it's a win code-wise or not.


Repository:
  rL LLVM

https://reviews.llvm.org/D53811





More information about the llvm-commits mailing list