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 PR 29984, PPC-SPE segfaults with MAX_EXPR <a, a>


> 
> Andrew Pinski <pinskia@gmail.com> writes:
> 
> > 	* tree-ssa-reassoc.c (eliminate_duplicate_pair): Handle MAX_EXPR
> > 	and MIN_EXRP.
> > 
> > 	* gcc.dg/tree-ssa/reassoc-12.c: New test.
> 
> This is OK.
> 
> Thanks.
> 
> > The reason why it ICEs is because the backend is not ready ready
> > to handle MAX_EXPR <a, a> which was created by the reassociation pass in
> > the first place.
> 
> And, in case you haven't already done it, it seems to me that you have
> to fix that anyhow, for -O0.

I cannot figure out a way to produce MAX_EXPR<a,a> at -O0.  Fold does not produce it
for "a>a?a:a" as it just produces a and fold has code to optimize MAX_EXPR and MIN_EXPR with 
the same operand down to that operand:

    case MIN_EXPR:
      if (operand_equal_p (arg0, arg1, 0))
        return omit_one_operand (type, arg0, arg1);
....

    case MAX_EXPR:
      if (operand_equal_p (arg0, arg1, 0))
        return omit_one_operand (type, arg0, arg1);

Thanks,
Andrew Pinski


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