This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/46781] [4.6 Regression] Missing optimization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46781

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.12.03 13:55:38
   Target Milestone|---                         |4.6.0
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-03 13:55:38 UTC ---
Confirmed.  GCC 4.5 tree DSE removes the first store to p:

fun (void * * q)
{
  void * r;
  void * * p.1;

<bb 2>:
  p.1_1 = p;
  p = 0B;
  r_3 = *q_2(D);
  p = p.1_1;
  return r_3;

and then PRE figures out the redundant store.

4.6 correctly preserves the store to p as the read from *q aliases it
(4.5 type-based aliasing concludes that void * doesn't alias void **,
something that people regularly get wrong thus I dumbed down TBAA).

Where did you get this testcase from?

To illustrate the difference, the following testcase is not optimized
by GCC 4.5 either (and that's required):

extern void **p;

void **fun (void ***q)
{
  void **t;
  void **r;

  t = p;
  p = 0;
  r = *q;
  p = t;

  return r;
}

The observed change is caused by:

2010-08-25  Richard Guenther  <rguenther@suse.de>

        * alias.c (get_alias_set): Assign a single alias-set to all pointers.
        * gimple.c (gimple_get_alias_set): Remove special handling
        for pointers.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]