This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/64130] vrp: handle non zero constant divided by range cannot be zero.


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64130

--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> ---
(for cmp1 (eq ne)
     cmp2 (lt ge)
 (simplify
  (cmp1 (trunc_div @0 @1) integer_zerop)
  (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
       || VECTOR_INTEGER_TYPE_P (TREE_TYPE (@0)))
   (cmp2 (abs @0) (abs @1)))))

(I assume that abs simplifies to the identity for unsigned)
But if we are going to use A/B anyway, computing two ABS may waste time, so
maybe restrict it to TYPE_UNSIGNED (TREE_TYPE (@0)) || single_use (@2) (where
@2 is the trunc_div) or something like that.


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