This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] PATCH to &&/|| gimplification
- From: Richard Henderson <rth at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 23 May 2003 12:57:11 -0700
- Subject: Re: [tree-ssa] PATCH to &&/|| gimplification
- References: <wvl3cj974pm.fsf@prospero.boston.redhat.com>
On Tue, May 20, 2003 at 04:17:41PM -0400, Jason Merrill wrote:
> int main()
> {
> int i = 0;
> int j;
> while (1)
> {
> if (i>2)
> break;
> j = i;
> ++i;
> }
> return j;
> }
>
> The RTL loop optimizer isn't clever enough to know that we will always
> execute the loop at least once, so j will always be initialized before use.
This is because the loop rotation code in expand_end_loop doesn't fire.
Which is because we don't emit a NOTE_INSN_LOOP_END_TOP_COND note. See
the commentary there and in the gcc-patches message that created
NOTE_INSN_END_TOP_COND for why.
> I think this bug needs to be fixed in the loop optimizer.
Not possible, IMO, for the reasons listed indirectly above.
The gimplifier either needs to rotate the loop itself, i.e. generate
if (i > 2)
do {
// ...
} while (i <= 2);
or leave simple conditionals in the WHILE_COND, or... I dunno.
r~