[PATCH] D21594: [esan|cfrag] Add counters for struct array accesses
Qin Zhao via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 1 15:34:57 PDT 2016
zhaoqin added a comment.
In http://reviews.llvm.org/D21594#472524, @dberlin wrote:
> You are right. What will happen is it will not look like a structure field
> access, and will use i8 or something so it can do the calculation.
> I'll paste a clang generated example in a bit
I just tried a manual test example as below:
%struct.RT = type { i8, [10 x [20 x i32]], i8 }
%struct.ST = type { i32, double, %struct.RT }
define i32* @foo(%struct.ST* %s) nounwind uwtable readnone optsize ssp {
entry:
%arrayidx = getelementptr inbounds %struct.ST, %struct.ST* %s, i64 0, i32 -1
ret i32* %arrayidx
}
which I tried gep on struct.ST with a negative field.
And I get the error that invalid getelementptr indices:
$ /usr/local/google/home/zhaoqin/Workspace/LLVM/builds/build_x64_rel.git/./bin/opt < /usr/local/google/home/zhaoqin/Workspace/LLVM/llvm.git/test/Instrumentation/EfficiencySanitizer/struct_field_gep.ll -esan -esan-cache-frag -S
/usr/local/google/home/zhaoqin/Workspace/LLVM/builds/build_x64_rel.git/./bin/opt: <stdin>:28:50: error: invalid getelementptr indices
%arrayidx = getelementptr inbounds %struct.ST, %struct.ST* %s, i64 0, i32 -1
^
http://reviews.llvm.org/D21594
More information about the llvm-commits
mailing list