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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-09-04

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
number_of_iterations_cltz_complement builds the COND_EXPR correctly.

In that it does:
(cast)(cast)(64 - (t !=0 ? .CLZ(t) : 64)) + 1

But calls fold_build2 to do the building
and that gets folded into:
t != 0 ? ((cast)(cast)(64 - .CLZ(t))) + 1 : 1
Which is fine.
and stores that into niter

But then we use force_gimple_operand/force_gimple_operand_gsi which does
creates the GIMPLE_COND ect.

And the check for rewriting from undefined to defined for addition is done via
the following check:
      /* If def's type has undefined overflow and there were folded
         casts, rewrite all stmts added for def into arithmetics
         with defined overflow behavior.  */
      if (folded_casts && ANY_INTEGRAL_TYPE_P (TREE_TYPE (def))
          && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (def)))

I don't know understand how folded_casts comes into play really.

Reply via email to