[PATCH] no lowering of &a.b (and &a->b) in the C front-end
Mon Aug 23 00:20:00 GMT 2004
Andrew Pinski <firstname.lastname@example.org> writes:
> I found that both the C and C++ front-ends do lower &a.b into a +
> offsetof(b,a) which is really not good for some optimizations which
> can change the struct a into scaler values.
> This patch changes the C front-end so there is no lowering and fixes
> a bug found in c_finish_return with the no lowering turned on.
> Warning about returning a temporary which is true for &a->b.
Can you give an example of code which is optimized better with your
> + addr2 = build1 (ADDR_EXPR, argtype, arg);
> + if (!TREE_CONSTANT (addr) || TREE_CONSTANT (addr2))
> + addr = addr2;
Why isn't this
if (!TREE_CONSTANT (addr))
addr = build1 (ADDR_EXPR, argtype, arg);
That avoids constructing a junk tree node in the majority of cases.
More information about the Gcc-patches