https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86097
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index bf425afd436..555842b8420 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -1542,7 +1542,7 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool
bump_in_latc
h)
precision = GET_MODE_PRECISION (mode);
type = build_nonstandard_integer_type (precision, unsigned_p);
- if (original_precision != precision)
+ if (original_precision != precision || type != TREE_TYPE (*nit))
{
*nit = fold_convert (type, *nit);
*nit = force_gimple_operand (*nit, &stmts, true, NULL_TREE);
...