This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] PATCH to gimplify_boolean_expr
- From: law at redhat dot com
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 25 Aug 2003 15:18:08 -0600
- Subject: Re: [tree-ssa] PATCH to gimplify_boolean_expr
- Reply-to: law at redhat dot com
In message <wvloeydbny0.fsf@prospero.boston.redhat.com>, Jason Merrill writes:
>--=-=-=
>
>While testing my patch to always evaluate complex expressions into formal
>temps, I ran into a new failure on gcc.dg/tree-ssa/20030728-1.c because the
>generated gimple code changed from
>
> T1 = (foo == bar);
> if (T1)
> ...
>
>to
>
> T1 = (foo == bar); // formal temp
> T2 = T1; // variable temp
> if (T2)
> ...
>
>dom provided constant defs of T2 within the branches, but ccp replaced uses
>of T2 with T1, so we didn't see them.
I'm not sure I follow. Dumps would probably help me understand what you
mean.
>One fix for this is to move the comparison directly into the condition,
>i.e.
>
>if (foo == bar)
> T1 = true;
> ...
>
>which seems to be roughly what the expander does. This also dramatically
>simplifies gimplify_boolean_expr; now we can just hand off to the code in
>shortcut_cond_expr.
As long as "foo" and "bar" are temporaries, I don't mind. One of the
problems we've got right now is that we can have nontrivial operands
inside COND_EXPR_COND. That inhibits redundant expression elimination.
>Another fix is to teach dom to propagate conditional information back up
>the def chain; I'll have a preliminary patch for that shortly.
Now that would be good. I've seen some tests where that could eliminate
some useless crud -- particuliarly where we lose information due to
casting between different types.
>Another fix would be to delay copy prop until out-of-ssa time, as Morgan
>does.
Note that Morgan does copy-prop during the dominator walk as well. It is
not delayed.
>This seems to shave 0.6% off bootstrap time and 0.8% off testrun time.
Cool.
Now I'm just waiting on Diego's change to allow us to convert that back to
a boolean assignment just before out-of-ssa as part of if-conversion :-)
Jeff