On Wed, Apr 20, 2016 at 1:19 PM, Marek Polacek <pola...@redhat.com> wrote:
> On Wed, Apr 20, 2016 at 12:54:12PM +0200, Richard Biener wrote:
>> On Wed, Apr 20, 2016 at 12:37 PM, Jakub Jelinek <ja...@redhat.com> wrote:
>> > On Wed, Apr 20, 2016 at 11:04:08AM +0200, Richard Biener wrote:
>> >> > --- gcc/tree-if-conv.c
>> >> > +++ gcc/tree-if-conv.c
>> >> > @@ -262,6 +262,16 @@ ifc_temp_var (tree type, tree expr, 
>> >> > gimple_stmt_iterator *gsi)
>> >> >    return new_name;
>> >> >  }
>> >> >
>> >> > +/* Return true when COND is a false predicate.  */
>> >> > +
>> >> > +static inline bool
>> >> > +is_false_predicate (tree cond)
>> >> > +{
>> >> > +  return (cond == NULL_TREE
>> >> > +         || cond == boolean_false_node
>> >> > +         || integer_zerop (cond));
>> >> > +}
>> >> > +
>> >
>> > Is it really a good idea to return true even for cond == NULL_TREE?
>> > I mean it is then very confusing, because both is_true_predicate and
>> > is_false_predicate are true in that case.
>>
>> Ah, indeed.  NULL_TREE is true, not false.
>
> I can fix it up with the following.
>
> Bootstrap/regtest pending on x86_64-linux, ok for trunk and 6 if it passes?

Works for me.

Richard.

> 2016-04-20  Marek Polacek  <pola...@redhat.com>
>
>         * tree-if-conv.c (is_false_predicate): For NULL_TREE return false
>         rather than true.
>
> diff --git gcc/tree-if-conv.c gcc/tree-if-conv.c
> index a9fbab9..72e808e 100644
> --- gcc/tree-if-conv.c
> +++ gcc/tree-if-conv.c
> @@ -267,9 +267,9 @@ ifc_temp_var (tree type, tree expr, gimple_stmt_iterator 
> *gsi)
>  static inline bool
>  is_false_predicate (tree cond)
>  {
> -  return (cond == NULL_TREE
> -         || cond == boolean_false_node
> -         || integer_zerop (cond));
> +  return (cond != NULL_TREE
> +         && (cond == boolean_false_node
> +             || integer_zerop (cond)));
>  }
>
>  /* Return true when COND is a true predicate.  */
>
>         Marek

Reply via email to