[PATCH] D26230: [AddressSanitizer] Add support for (constant-)masked loads and stores.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 11:06:43 PST 2016


RKSimon added inline comments.


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1055
+      // Only instrument if the mask is constant for now.
+      if (dyn_cast<ConstantVector>(CI->getOperand(2 + OpOffset))) {
+        auto BasePtr = CI->getOperand(0 + OpOffset);
----------------
Use isa<> instead as we don't use the return value from dyn_cast<> ?


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1059
+        *TypeSize = DL.getTypeStoreSizeInBits(Ty);
+        *Alignment = (unsigned)cast<ConstantInt>(CI->getOperand(1 + OpOffset))
+                         ->getZExtValue();
----------------
I don't think we can guarantee ConstantInt type here (UndefValue etc.?)


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1152
+  for (unsigned Idx = 0; Idx < Num; ++Idx) {
+    auto Masked = cast<ConstantInt>(Mask->getOperand(Idx));
+    if (Masked->isAllOnesValue()) {
----------------
I don't think we can guarantee ConstantInt type here (UndefValue etc.?)


https://reviews.llvm.org/D26230





More information about the llvm-commits mailing list