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

            Bug ID: 123972
           Summary: gimple_assign_cast_p should be removed
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

/* Return true if S is a type-cast assignment.  */

inline bool
gimple_assign_cast_p (const gimple *s)
{
  if (is_gimple_assign (s))
    {
      enum tree_code sc = gimple_assign_rhs_code (s);
      return CONVERT_EXPR_CODE_P (sc)
             || sc == VIEW_CONVERT_EXPR
             || sc == FIX_TRUNC_EXPR;
    }

  return false;
}

is not complete (FLOAT_EXPR is missing) and overly broad for many cases
resulting in code like

              if (gimple_assign_cast_p (g)
                  && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (g))))

to exempt FIX_TRUNC_EXPR for example.

More specialized gimple_integer_conversion_p or gimple_nop_conversion_p
predicates should be better.  A is_gimple_assign overload with one
(or more) expression codes might be better (or finally finish the
NOP/CONVERT_EXPR unification, at least on GIMPLE).

Reply via email to