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: Daniel Berlin <dberlin at dberlin dot org>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 25 Aug 2003 15:15:04 -0400
- Subject: Re: [tree-ssa] PATCH to gimplify_boolean_expr
- References: <wvloeydbny0.fsf@prospero.boston.redhat.com>
On Monday, August 25, 2003, at 2:18 PM, Jason Merrill wrote:
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.
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.
If you do this, it means we won't hoist the comparison out loops,
because we don't hoist control statements (cause it's much trickier in
our current representation)
IE before
int a = <blah1>
int b = <blah2>
for (i = 0; i < 50; i ++)
{
T.1 = a == b
if (T.1)
{
...
}
}
We'd transform this into:
int a = <blah1>
int b = <blah2>
T.1 = a == b;
for (i = 0; i < 50; i++)
{
if (T.1)
{
...
}
}
If you make it into
if (a == b)
we won't hoist anything.