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: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2006 12:37:54 -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 #8 from rguenther at suse dot de 2006-11-06 12:37 -------
Subject: Re: Missed constant propagation into
loops
On Mon, 6 Nov 2006, rakdver at atrey dot karlin dot mff dot cuni dot cz wrote:
>
>
> ------- Comment #7 from rakdver at atrey dot karlin dot mff dot cuni dot cz 2006-11-06 12:33 -------
> Subject: Re: Missed constant propagation into loops
>
> > But obviously for real operands, foo () won't clobber them. I.e. the following
> > also could be optimized but is not:
> >
> > void foo (int *);
> > void bar (void)
> > {
> > int j;
> > int i;
> > i = 0;
> > for (j = 0; j < 10000; j++)
> > if (i)
> > foo (&i);
> > }
> >
> > foo () will be never executed, so the clobbering of i is not "executed",
> > so we don't need i as PHI arg/result for the loop. This is what I'm looking
> > for as optimization.
>
> now you have lost me, I have no idea what you are trying to tell. What
> I mean is that this is exactly the same case like
>
> void bar (void)
> {
> int j;
> int i;
> i = 0;
> for (j = 0; j < 10000; j++)
> if (i)
> i = 1;
> }
>
> Except that in the testcase for the PR, "i" is not a real operand.
> Since we already have some support for virtual operands in ccp, it
> should not be too difficult to make it handle this case as well.
Ah, I see. You are of course completely right. Now the question is,
why does store_ccp not handle it? (Maybe it is as dis-functional as
store_copyprop was until I fixed it?)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29738