This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21636] Missed ccp optimization
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2005 20:56:09 -0000
- Subject: [Bug tree-optimization/21636] Missed ccp optimization
- References: <20050517220859.21636.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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