This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/29738] Missed constant propagation into loops
- From: "sebastian dot pop at cri dot ensmp dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2006 11:48:37 -0000
- Subject: [Bug tree-optimization/29738] Missed constant propagation into loops
- References: <bug-29738-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from sebastian dot pop at cri dot ensmp dot fr 2006-11-06 11:48 -------
Subject: Re: Missed constant propagation into loops
I think the problem is that "i" is a global variable and thus foo is
potentially
considered as modifying "i". Have you tried
void foo (void);
void bar (void)
{
int i, j;
i = 0;
for (j = 0; j < 10000; j++)
if (i)
foo ();
}
This should be a simpler case that either is correctly simplified or I know
what to do for making it work.
For the original problem, why don't we propagate constants in
# i_3 = V_MUST_DEF <i_2>;
i = 0;
# NONLOCAL.6_19 = PHI <NONLOCAL.6_9(5), NONLOCAL.6_11(2)>;
# i_18 = PHI <i_7(5), i_3(2)>;
i.e. replacing the use of i_3 with just the constant 0?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29738