This is the mail archive of the gcc-patches@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: [PATCH] Fix PR28900, non-gimple from tree-ifcvt


On Sun, 3 Sep 2006, Andrew Pinski wrote:

> On Sun, 2006-09-03 at 16:30 +0200, Richard Guenther wrote:
> > This fixes PR28900 by ensuring to properly gimplify trees created
> > by collecting conditions.
> > 
> > Bootstrapped and tested on x86_64-unknown-linux-gnu.
> > 
> > Ok for mainline?
> > Thanks,
> > Richard.
> > 
> > :ADDPATCH middle-end:
> > 
> > 2006-09-03  Richard Guenther  <rguenther@suse.de>
> > 
> > 	PR tree-optimization/28900
> > 	* tree-if-conv.c (find_phi_replacement_condition): Gimplify
> > 	compound conditional before creating COND_EXPR condition.
> > 
> > 	* gcc.dg/torture/pr28900.c: New testcase
> > 
> > Index: tree-if-conv.c
> > ===================================================================
> > *** tree-if-conv.c	(revision 116660)
> > --- tree-if-conv.c	(working copy)
> > *************** find_phi_replacement_condition (struct l
> > *** 666,672 ****
> >   {
> >     basic_block first_bb = NULL;
> >     basic_block second_bb = NULL;
> > !   tree tmp_cond;
> >   
> >     gcc_assert (EDGE_COUNT (bb->preds) == 2);
> >     first_bb = (EDGE_PRED (bb, 0))->src;
> > --- 666,672 ----
> >   {
> >     basic_block first_bb = NULL;
> >     basic_block second_bb = NULL;
> > !   tree tmp_cond, new_stmts;
> >   
> >     gcc_assert (EDGE_COUNT (bb->preds) == 2);
> >     first_bb = (EDGE_PRED (bb, 0))->src;
> > *************** find_phi_replacement_condition (struct l
> > *** 732,737 ****
> > --- 732,740 ----
> >        value as condition. Various targets use different means to communicate
> >        condition in vector compare operation. Using gimple value allows compiler
> >        to emit vector compare and select RTL without exposing compare's result.  */
> > +   *cond = force_gimple_operand (*cond, &new_stmts, false, NULL_TREE);
> > +   if (new_stmts)
> > +     bsi_insert_before (bsi, new_stmts, BSI_SAME_STMT);
> >     if (!is_gimple_reg (*cond) && !is_gimple_condexpr (*cond))
> >       {
> >         tree new_stmt;
> 
> This force_gimple_operand should be done inside the if statement of the
> next check which makes it easier to understand why you are forcing it
> and should save some compile time too.

No, this doesn't work.  A more consistent way would be to use
force_gimple_operand (, , true, ), but then ifcvt doesn't look through
conditions DEF appearantly, so a lot of ifcvt tests regress.

Richard.

--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs


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