[PATCH] D21594: [esan|cfrag] Add counters for struct array accesses
Qin Zhao via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 1 17:11:18 PDT 2016
>
> However, you have a worse situation - not every field access is going to
look like an access through a structure type ;)
>
> Clang will happily generate code like this:
> %20 = load %struct.A*, %struct.A** %3, align 8
> %21 = bitcast %struct.A* %20 to i8*
> %22 = getelementptr inbounds i8, i8* %21, i64 %19
>
> ....
>
I totally agree.
There are many more cases that we might not catch. We just use gep
instructions to approximate the struct field accesses. One gep instruction
may means 0 or many field accesses. I just hope that the collected data
would give us a good enough estimation for optimization.
>>
>> $
/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
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160701/da4ca586/attachment.html>
More information about the llvm-commits
mailing list