[Bug tree-optimization/21636] Missed ccp optimization

kazu at cs dot umass dot edu gcc-bugzilla@gcc.gnu.org
Wed May 18 20:56:00 GMT 2005


------- Additional Comments From kazu at cs dot umass dot edu  2005-05-18 20:56 -------
Confirmed.

Here is what I get from the first CCP.

int g() ()
{
  int * i;
  struct f * a1;
  struct f a;
  int D.1687;

<bb 0>:
  a.i = 1;
  a1_3 = &a;
  i_4 = &a.i;
  D.1687_5 = *i_4;
  D.1687_6 = D.1687_5;
  return D.1687_6;

}

As Andrew has stated, the propagator does not know that i_4 == &a.i,
which is a gimple min invariant.  This prevents *i_4 from being folded
to a.i.

The problem is that ccp_fold does not know how to fold &(&a)->i.
Teaching ccp_fold solves this problem.

Unfortunately, we cannot call fold_stmt because it destructively folds
a statement.  We need a folder that returns a folded expression without
modifying the original expression.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-18 20:56:07
               date|                            |


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



More information about the Gcc-bugs mailing list