[cfe-dev] MRV on x86_64
Eli Friedman
eli.friedman at gmail.com
Thu Mar 10 13:40:24 PST 2011
On Thu, Mar 10, 2011 at 1:09 PM, Arushi Aggarwal <arushi987 at gmail.com> wrote:
> Hi,
>
> I am using clang on the following code,
>
> struct S {
> float a,b,c;
> };
>
> void foo(struct S obj) {
> obj.a = 1.2;
> }
>
> int main() {
> struct S s;
> s.a = 1.0;
> s.b = 1.0;
> s.c = 1.0;
> foo(s);
> return 0;
> }
>
> The generated code for foo, changes the type of the argument to foo to be
> {double, double} .
>
> llvm-gcc was converting this to {double, float} which was an ABI
> requirement, as par an older
> discussion(http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-January/028870.html)
>
> Why does clang change it to a struct with a different size?
clang uses different code written from scratch, so there are
differences in the output. In this case, it's a missed optimization;
ideally, I think the signature of foo would be @_Z3foo1S(<2 x float>,
float).
-Eli
More information about the cfe-dev
mailing list