tree access_fn = NULL;
tree evolution_part;
tree init_expr;
- tree step_expr;
+ tree step_expr, off;
+ tree type;
tree var, ni, ni_name;
gimple_stmt_iterator last_gsi;
access_fn = analyze_scalar_evolution (loop, PHI_RESULT (phi));
gcc_assert (access_fn);
+ /* We can end up with an access_fn like
+ (short int) {(short unsigned int) i_49, +, 1}_1
+ for further analysis we need to strip the outer cast but we
+ need to preserve the original type. */
+ type = TREE_TYPE (access_fn);
STRIP_NOPS (access_fn);
evolution_part =
unshare_expr (evolution_part_in_loop_num (access_fn, loop->num));
step_expr = evolution_part;
init_expr = unshare_expr (initial_condition_in_loop_num (access_fn,
loop->num));
+ init_expr = fold_convert (type, init_expr);
+ off = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
+ fold_convert (TREE_TYPE (step_expr), niters),
+ step_expr);
if (POINTER_TYPE_P (TREE_TYPE (init_expr)))
ni = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (init_expr),
- init_expr,
- fold_convert (sizetype,
- fold_build2 (MULT_EXPR, TREE_TYPE (niters),
- niters, step_expr)));
+ init_expr,
+ fold_convert (sizetype, off));
else
ni = fold_build2 (PLUS_EXPR, TREE_TYPE (init_expr),
- fold_build2 (MULT_EXPR, TREE_TYPE (init_expr),
- fold_convert (TREE_TYPE (init_expr),
- niters),
- step_expr),
- init_expr);
-
-
+ init_expr,
+ fold_convert (TREE_TYPE (init_expr), off));
var = create_tmp_var (TREE_TYPE (init_expr), "tmp");
add_referenced_var (var);
niters = fold_build2 (MULT_EXPR, sizetype,
fold_convert (sizetype, niters),
fold_convert (sizetype, DR_STEP (dr)));
- offset = fold_build2 (PLUS_EXPR, sizetype, offset, niters);
+ offset = fold_build2 (PLUS_EXPR, sizetype,
+ fold_convert (sizetype, offset), niters);
DR_OFFSET (dr) = offset;
}
else
*cond_expr = part_cond_expr;
}
- if (vect_print_dump_info (REPORT_VECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS))
fprintf (vect_dump, "created %u versioning for alias checks.\n",
VEC_length (ddr_p, may_alias_ddrs));