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: VRP speedup 2


On 12/7/06, Jan Hubicka <jh@suse.cz> wrote:
Hi,
this patch removes rest of boolean_true_node checks (it is only one
left; I also short circuited integer_cst) and optimize the
value_intersect_p.
I didn't measured any notable speedups on the testcase but I think it is
still worth.

:ADDPATCH middle-end:
Bootstrapped/regtested i686-linux, OK?
        * tree-vrp.c (compare_values): Short circuit INTEGER_CST;
        use fold_constant_to_binary; tolerate wrong type constants.
        (value_intersect_p): Do just two tests.
Index: tree-vrp.c
===================================================================
*** tree-vrp.c  (revision 119583)
--- tree-vrp.c  (working copy)
*************** compare_values (tree val1, tree val2)
*** 620,629 ****
        if (operand_less_p (val2, val1) == 1)
        return 1;

!       /* If VAL1 is different than VAL2, return +2.  */
!       t = fold_binary (NE_EXPR, boolean_type_node, val1, val2);
!       if (t == boolean_true_node)
!       return 2;

        return -2;
      }
--- 620,635 ----
        if (operand_less_p (val2, val1) == 1)
        return 1;

!       /* If VAL1 is different than VAL2, return +2.
!        For integer constants we either have already returned -1 or 1
!        or they are equivalent.  We still might suceed prove something
!        about non-trivial operands.  */
!       if (TREE_CODE (val1) != INTEGER_CST || TREE_CODE (val2) != INTEGER_CST)

Please separate the || operands on different lines.


!       {
!           t = fold_binary_to_constant (NE_EXPR, boolean_type_node, val1, val2);
!         if (t && tree_expr_nonzero_p (t))
!           return 2;
!       }

        return -2;
      }
*************** value_inside_range (tree val, value_rang
*** 682,691 ****
  static inline bool
  value_ranges_intersect_p (value_range_t *vr0, value_range_t *vr1)
  {
!   return (value_inside_range (vr1->min, vr0) == 1
!         || value_inside_range (vr1->max, vr0) == 1
!         || value_inside_range (vr0->min, vr1) == 1
!         || value_inside_range (vr0->max, vr1) == 1);
  }


--- 688,701 ---- static inline bool value_ranges_intersect_p (value_range_t *vr0, value_range_t *vr1) { ! /* The values does not intersect if maximum of first is smaller than ! minimum of second or vice versa. ! When those relations are unknown or false, we can't do any better. */

/* The value ranges do not intersect if the maximum of the first range is less than the minimum of the second range or vice versa. When those relations are unknown, we can't do any better. */

!   if (operand_less_p (vr0->max, vr1->min) != 0)
!     return false;
!   if (operand_less_p (vr1->max, vr0->min) != 0)
!     return false;
!   return true;
  }

Ok with these changes.


Richard.


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