------- Comment #3 from rguenther at suse dot de 2006-11-06 12:04 ------- Subject: Re: Missed constant propagation into loops
On Mon, 6 Nov 2006, rakdver at gcc dot gnu dot org wrote: > > > ------- Comment #2 from rakdver at gcc dot gnu dot org 2006-11-06 11:51 > ------- > > Have you tried > > > > void foo (void); > > void bar (void) > > { > > int i, j; > > i = 0; > > for (j = 0; j < 10000; j++) > > if (i) > > foo (); > > } > > This would work, obviously. > > > 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? > > Because i is a virtual operand, not real one. But that doesn't help that i is loop-carried and so we don't propagate it to the if () stmt - we use i_18 there. Or am I missing something? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29738