On Fri, May 27, 2022 at 9:34 PM Andi Kleen via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Andrew MacLeod via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > > > > diff --git a/gcc/gimple-range-side-effect.cc > > b/gcc/gimple-range-side-effect.cc > > index 2c8c77dc569..548e4bea313 100644 > > --- a/gcc/gimple-range-side-effect.cc > > +++ b/gcc/gimple-range-side-effect.cc > > @@ -116,6 +116,23 @@ stmt_side_effects::stmt_side_effects (gimple *s) > > walk_stmt_load_store_ops (s, (void *)this, non_null_loadstore, > > non_null_loadstore); > > > > + if (is_a<gassign *> (s)) > > + { > > + switch (gimple_assign_rhs_code (s)) > > + { > > + case TRUNC_DIV_EXPR: > > + case CEIL_DIV_EXPR: > > + case FLOOR_DIV_EXPR: > > + case ROUND_DIV_EXPR: > > + case EXACT_DIV_EXPR: > > + // Divide means operand 2 is not zero after this stmt. > > + if (gimple_range_ssa_p (gimple_assign_rhs2 (s))) > > + add_nonzero (gimple_assign_rhs2 (s)); > > Sorry I'm late, but how does this ensure the value is a integer? > I believe for floating point the assumption is not correct because > division by zero doesn't necessarily fault.
non-integer divisions use a different TREE_CODE (RDIV_EXPR). > > -Andi