[PATCH] D21594: [esan|cfrag] Add counters for struct array accesses
Qin Zhao via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 1 08:29:39 PDT 2016
zhaoqin marked an inline comment as done.
================
Comment at: lib/Transforms/Instrumentation/EfficiencySanitizer.cpp:738
@@ +737,3 @@
+ continue;
+ CounterIdx = Idx->getZExtValue();
+ if (CounterIdx >= StructTy->getNumElements())
----------------
dberlin wrote:
> 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 :)
>
As you can see, the Idx here is to get from a struct field, if (isa<StructType>(Ty))
I do not think a negative index for struct field indexing is valid.
http://reviews.llvm.org/D21594
More information about the llvm-commits
mailing list