<div dir="auto">Hi Tim,<div dir="auto">Thanks again for your help. All clear now</div><div dir="auto"><br></div><div dir="auto">Alberto</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 10, 2019, 08:59 Tim Northover <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alberto,<br>
<br>
> I would like to understand where bitcast is defined because it is not defined within libpng.<br>
<br>
It's because the function (@png_set) has been defined to take one kind<br>
of argument, but is being called with another. In this case the<br>
difference seems to be whether it takes pointers to<br>
%struct.png_struct_def or %struct.png_struct_def.68.<br>
<br>
This kind of situation isn't terribly common, but can happen for<br>
example in LTO where two modules are linked together, and one of them<br>
only has an opaque handle for the type to hide the implementation<br>
(e.g. from plain "struct png_struct_def;" in C). When that happens<br>
LLVM can't merge the types, so it adds a numeric tag to one of them,<br>
and then it has to insert bitcasts in the calls like this so that its<br>
own type system works.<br>
<br>
> I also noticed that the @ is not present, what does the missing @ mean? I guess it must be an LLVM function.<br>
<br>
The @ is only used directly before a global variable (including a<br>
declared/defined function). In this case it's buried, but it is there<br>
(@png_set). In other cases, like when you call a function pointer, it<br>
will be missing entirely.<br>
<br>
Cheers.<br>
<br>
Tim.<br>
</blockquote></div>