[PATCH] D21594: [esan|cfrag] Add counters for struct array accesses

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 13:17:21 PDT 2016


dberlin added a subscriber: dberlin.

================
Comment at: lib/Transforms/Instrumentation/EfficiencySanitizer.cpp:738
@@ +737,3 @@
+        continue;
+      CounterIdx = Idx->getZExtValue();
+      if (CounterIdx >= StructTy->getNumElements())
----------------
So it looks like you just ignore any negative indices?
(but you don't mark them ignored)

Note that both
   %a = getelementptr inbounds {[2 x i8], [2 x i8]}, {[2 x i8], [2 x i8]}* %p, i32 0, i32 0, i32 1
  %b = getelementptr inbounds {[2 x i8], [2 x i8]}, {[2 x i8], [2 x i8]}* %p, i32 0, i32 1, i32 -1

are valid :)



http://reviews.llvm.org/D21594





More information about the llvm-commits mailing list