<div dir="ltr">Hey taewook,<div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 14, 2016 at 1:14 PM, Taewook Oh <span dir="ltr"><<a href="mailto:twoh@fb.com" target="_blank">twoh@fb.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">twoh added a comment.<br>
<br>
@dberlin I meant the same level of type information as tbaa for GEP's pointer operand.<br>
<br></blockquote><div><br></div><div>But i guess i don't see how that helps, as it doesn't matter until you see a load . So why wouldn't you just annotate the load directly?<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
For eli's example above, if the original access were to the array field of the struct, clang generates GEP like<br>
<br>
  %20 = load %struct.A*, %struct.A** %3, align 8<br>
  %21 = getelementptr inbounds %struct.A, %struct.A* %20, i32 0, i32 0<br>
  %22 = getelementptr inbounds [10 x i8], [10 x i8]* %21, i64 0, i64 %19<br>
<br>
But if the access were to char* casted pointer, then it is like<br>
<br>
  %20 = load %struct.A*, %struct.A** %3, align 8<br>
  %21 = bitcast %struct.A* %20 to i8*<br>
  %22 = getelementptr inbounds i8, i8* %21, i64 %19<br>
<br>
and these instructions are eventually combined to<br>
<br>
  %10 = getelementptr inbounds %struct.A, %struct.A* %0, i64 0, i32 0, i64 %9<br>
<br>
So by knowing the original pointer operand type of GEP, it is possible to tell if the original accesses were to the field of the struct itself or to the casted pointer, assuming that clang generates bitscast operation for every type casting.<br></blockquote><div><br></div><div>You are not guaranteed that llvm types, fields, etc, have *any* relation to source ones, so again, i guess i don't see what this helps.</div><div><br></div><div>The type of metadata i would see helping for you would simply by something like tbaa struct path data with no types attached.  IE you just want to know if the accesses are to things C considers different fields.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D20665" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20665</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div></div>