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

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 20 Jun 2018, vries at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86097
> 
> --- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
> Earliest point of detection:
> ...
> @@ -1570,6 +1570,7 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, 
> bool
> bump_in_latch)
>        fe->flags = EDGE_TRUE_VALUE;
>      }
>    gimple_cond_set_code (stmt, LT_EXPR);
> +  gcc_assert (TREE_TYPE (var_before) == TREE_TYPE (*nit));
>    gimple_cond_set_lhs (stmt, var_before);
>    gimple_cond_set_rhs (stmt, *nit);
>    update_stmt (stmt);
> ...

So I wonder why we can assume that *nit has type 'type' (I assume
var_before gets type 'type' via create_iv getting zero and one of that
type).  That is, we do

  if (original_precision != precision)
    {
      *nit = fold_convert (type, *nit);
      *nit = force_gimple_operand (*nit, &stmts, true, NULL_TREE);
      if (stmts)
        gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), 
stmts);
    }

but that misses checking for signedness match.

Reply via email to