Hi,<br><br>Also, is there a specific flag that I can pass to clang, to make sure it does optimizations like these, as I am passing the -disable-llvm-optzns flag, in general, to disable any other optimizations.<br><br>Regards,<br>

Arushi<br><br><div class="gmail_quote">On Thu, Mar 10, 2011 at 4:14 PM, Arushi Aggarwal <span dir="ltr"><<a href="mailto:arushi987@gmail.com">arushi987@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Thu, Mar 10, 2011 at 3:40 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>On Thu, Mar 10, 2011 at 1:09 PM, Arushi Aggarwal <<a href="mailto:arushi987@gmail.com" target="_blank">arushi987@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I am using clang on the following code,<br>
><br>
> struct S {<br>
>   float a,b,c;<br>
> };<br>
><br>
> void foo(struct S obj) {<br>
>   obj.a = 1.2;<br>
> }<br>
><br>
> int main() {<br>
>   struct S s;<br>
>   s.a = 1.0;<br>
>   s.b = 1.0;<br>
>   s.c = 1.0;<br>
>   foo(s);<br>
>   return 0;<br>
> }<br>
><br>
> The generated code for foo, changes the type of the argument to foo to be<br>
> {double, double} .<br>
><br>
> llvm-gcc was converting this to {double, float} which was an ABI<br>
> requirement, as par an older<br>
> discussion(<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-January/028870.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-January/028870.html</a>)<br>
><br>
> Why does clang change it to a struct with a different size?<br>
<br>
</div>clang uses different code written from scratch, so there are<br>
differences in the output.  In this case, it's a missed optimization;<br>
ideally, I think the signature of foo would be @_Z3foo1S(<2 x float>,<br>
float).<br></blockquote></div></div><div><br>Is this something that I should maybe file a bug for?<br><br>Thanks! <br>Arushi<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



<font color="#888888"><br>
-Eli<br>
</font></blockquote></div><br>
</blockquote></div><br>