This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: More PRE problems
- From: law at redhat dot com
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 17 Nov 2003 08:54:07 -0700
- Subject: Re: More PRE problems
- Reply-to: law at redhat dot com
In message <20031117153713.GA11815@nevyn.them.org>, Daniel Jacobowitz writes:
>> In which case it would sound to me like the PHI insertion sites were
>> goof'd up since PRE should be eliminating loop invariants.
>
>My SSA-fu is pretty weak, but I think it's easy to get such a PHI for
>non-invariants...
>
> i = 3;
> j = 0;
>
>.L4: j++;
> if (i+j < 100) goto .L4
>
> i++;
> if (i+j < 1000) goto .L4
>
>At L4 we'd have a PHI with three incoming edges, something like:
> i_1 = 3;
>
>.L4: i_2 = PHI<i_1, i_2, i_3>
>
> i_3 = i_2 + 1;
Well, this is the kind of situation I was talking about.
What ought to happen is something like this:
i_1 = 3;
j_1= 0;
goto .L4
.L5:
i_3 = PHI (i_2, i_1)
.L4: j_3 = PHI (j_1, j_2)
i_4 = PHI (i_1, i_3)
j_2 = j_3 + 1;
if (i_4+j_3 < 100) goto .L4
i_2 = i_4 + 1;
if (i_2+j_2 < 1000) goto .L5
Or something along those lines.
jeff