This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Grammar for GIMPLE condexprs


On Tue, 2003-03-25 at 13:40, Jason Merrill wrote:
> On 25 Mar 2003 13:33:26 -0500, Diego Novillo <dnovillo at redhat dot com> wrote:
> 
> > On Tue, 2003-03-25 at 13:18, Jason Merrill wrote:
> >
> >> >   T.225 = a.224 < 0;
> >> >   b.226 = (int)b;
> >> >   T.227 = b.226 >= 0;
> >> >   if (T.225 ^ T.227)
> >> 
> >> is_simple_condexpr currently allows TRUTH_XOR_EXPR, which I assume is the
> >> code in the above tree, rather than the C ^, which is BIT_XOR_EXPR.  This
> >> seems reasonable to me.
> >> 
> > Yes.  That '^' is TRUTH_XOR_EXPR.  By moving TRUTH_AND_EXPR,
> > TRUTH_OR_EXPR and TRUTH_XOR_EXPR to is_simple_binary_expr I force the
> > gimplifier to create another temporary.  It works, but at the expense of
> > another temporary.  Ugh.
> 
> Is that really so horrible?  AFAIK, the main reason for allowing
> comparisons in the condition operand is so that we can translate them
> directly into conditional jumps.  If we can't do that anyway, I don't see
> the harm in using a temporary.
> 
Well, I can't say that I have done tests on the generated code.  I don't
really know.  Perhaps I should take a look.  We do have a runtime
performance problem when GIMPLE is enabled, so generating more
temporaries may not be a good idea.


> How hard do you look for a matching predicate?  I doubt that you'd see
> T.225 ^ T.227 again, though you might see the original expression involving
> a and b.
> 
We spend almost zero effort.  It comes for free because these are simple
hash table lookups done while we rename the program into SSA.  Mostly,
this will catch things like:

v = foo()
if (v == 3)
  ... uses of v get replaced with 3 here ...

But, no.  I don't expect this to give huge improvements.  It comes under
the category of "hell, we get it for free".


> > Would that stop fold() from getting all confused?  If so, I'd rather do
> > this.
> 
> It would in this case; you can pass anything with BOOLEAN_TYPE to
> invert_truthvalue.
> 
OK.  I will try that.


Thanks.  Diego.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]