Adds one counter to the struct counter array for counting struct
array accesses.
Adds instrumentation to insert counter update for struct array
accesses.
Paths
| Differential D21594
[esan|cfrag] Add counters for struct array accesses ClosedPublic Authored by zhaoqin on Jun 21 2016, 8:26 PM.
Details Summary Adds one counter to the struct counter array for counting struct Adds instrumentation to insert counter update for struct array
Diff Detail
Event Timelinezhaoqin updated this object. This revision now requires changes to proceed.Jun 23 2016, 2:52 PM
• dberlin added inline comments.
Comment Actions
FWIW, this is a common mistake. GEP is just an indexing operation. Unlike C, i can form pointers to zhaoqin edited edge metadata. Comment Actionsuse getSExtValue instead of getZExtValue for GetElementPtr instr. Comment Actions
I see, thanks! Update CL.
I understand that GEP is just an indexing operation, which I treat it like LEA instr in x86. Comment Actions You are right. What will happen is it will not look like a structure field This revision is now accepted and ready to land.Jul 1 2016, 2:44 PM Comment Actions
I just tried a manual test example as below: %struct.RT = type { i8, [10 x [20 x i32]], i8 } define i32* @foo(%struct.ST* %s) nounwind uwtable readnone optsize ssp { %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. $ /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 %arrayidx = getelementptr inbounds %struct.ST, %struct.ST* %s, i64 0, i32 -1 ^ Comment Actions Even without esan instrumentation, the same error. /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 -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 ^ Closed by commit rL274420: [esan|cfrag] Add counters for struct array accesses (authored by zhaoqin). · Explain WhyJul 1 2016, 8:32 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 62597 llvm/trunk/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp
llvm/trunk/test/Instrumentation/EfficiencySanitizer/struct_field_count_basic.ll
llvm/trunk/test/Instrumentation/EfficiencySanitizer/struct_field_gep.ll
|