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: "rakdver at atrey dot karlin dot mff dot cuni dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2006 12:08:21 -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 #5 from rakdver at atrey dot karlin dot mff dot cuni dot cz 2006-11-06 12:08 -------
Subject: Re: Missed constant propagation into loops
> > ------- 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?
ccp can handle this for real operands.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29738