This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19626] New: Aliasing says stores to local memory do alias
- From: "rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jan 2005 16:56:32 -0000
- Subject: [Bug tree-optimization/19626] New: Aliasing says stores to local memory do alias
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Given the attached testcase, for reference, the interesting function is
this:
int loc_test(void)
{
const Loc<2> dX(1, 0);
const Loc<2> k(0, 1);
return k[0].first() + dX[0].first();
}
aliasing tells us that the initializations of dX and k alias each
other:
<bb 0>:
D.2540 = (struct Loc<1> *) &dX.D.2210.D.2166.domain_m.buffer;
# dX_357 = V_MAY_DEF <dX_318>;
# k_358 = V_MAY_DEF <k_317>;
*&(&D.2540->D.2094)->D.2057.domain_m = 1;
# dX_365 = V_MAY_DEF <dX_357>;
# k_364 = V_MAY_DEF <k_358>;
*&(&(D.2540 + 4B)->D.2094)->D.2057.domain_m = 0;
D.2682 = (struct Loc<1> *) &k.D.2210.D.2166.domain_m.buffer;
# dX_337 = V_MAY_DEF <dX_365>;
# k_338 = V_MAY_DEF <k_364>;
*&(&D.2682->D.2094)->D.2057.domain_m = 0;
# dX_361 = V_MAY_DEF <dX_337>;
# k_63 = V_MAY_DEF <k_338>;
*&(&(D.2682 + 4B)->D.2094)->D.2057.domain_m = 1;
D.2769 = (struct Loc<1> *) &k.D.2210.D.2166.domain_m.buffer;
D.2791 = (struct Loc<1> *) &dX.D.2210.D.2166.domain_m.buffer;
return (&D.2769->D.2094)->D.2057.domain_m + (&D.2791->D.2094)->D.2057.domain_m;
which is of course (trivially) not true. This may be obfuscated by
the actual implementation of the template class Loc (see attached
complete testcase).
At the RTL level we are able to optimize this to just return 1, as
expected. This pessimizes tree loop optimizations if such constructs
are used inside a loop and as induction variable.
--
Summary: Aliasing says stores to local memory do alias
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at tat dot physik dot uni-tuebingen dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19626