[Bug tree-optimization/69653] More CSE opportunities in address expressions

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 4 12:24:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69653

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-02-04
                 CC|                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We've talked about lowering memory references somewhere on GIMPLE.  The issue
is always failing dependence queries and forcing decls to be addressable
(causing
the same issue).

But I don't think it was backed up with real numbers if done reasonably late
(read: after loop opts but before the final DOM which would do some CSE).

If you look at gimple-laddress.c you can see how lowering can be easily
achieved (if you have some followup cleanup passes).

For each not already lowered address do

 1) take its address and lower it the laddress way
 2) create a new reference based on dereferencing that pointer

You might want to restrict yourself to non-invariant "pieces", thus for example
lower a.b.c[j].d[3].e as

  void *p = &a.b.c[j]; // lowered
  ... = MEM [p].d[3].e;

because for the non-constant part we're not very smart anyway (after loop
opts).

The requirement to mark 'a' as TREE_ADDRESSABLE might still be the killer
though.

Which leaves us with the question why RTL optimizers don't do their job.


More information about the Gcc-bugs mailing list