Commit 17067056 by Richard Biener Committed by Richard Biener

re PR tree-optimization/88651 (tree-data-ref.c:3764:26: runtime error: signed…

re PR tree-optimization/88651 (tree-data-ref.c:3764:26: runtime error: signed integer overflow: 9223372036854775802 - -6 cannot be represented in type 'long int')

2019-01-02  Richard Biener  <rguenther@suse.de>

	PR middle-end/88651
	* tree-data-ref.c (analyze_subscript_affine_affine): Use
	widest_ints when mangling max_stmt_execution results.

From-SVN: r267512
parent dcff404e
2019-01-02 Richard Biener <rguenther@suse.de> 2019-01-02 Richard Biener <rguenther@suse.de>
PR middle-end/88651
* tree-data-ref.c (analyze_subscript_affine_affine): Use
widest_ints when mangling max_stmt_execution results.
2019-01-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/88621 PR tree-optimization/88621
* tree-ssa-loop-im.c (gather_mem_refs_stmt): Fix pastos, avoid * tree-ssa-loop-im.c (gather_mem_refs_stmt): Fix pastos, avoid
bitfields when canoncalizing. bitfields when canoncalizing.
......
...@@ -3761,10 +3761,6 @@ analyze_subscript_affine_affine (tree chrec_a, ...@@ -3761,10 +3761,6 @@ analyze_subscript_affine_affine (tree chrec_a,
if (niter > 0) if (niter > 0)
{ {
HOST_WIDE_INT tau2 = MIN (FLOOR_DIV (niter_a - i0, i1),
FLOOR_DIV (niter_b - j0, j1));
HOST_WIDE_INT last_conflict = tau2 - (x1 - i0)/i1;
/* If the overlap occurs outside of the bounds of the /* If the overlap occurs outside of the bounds of the
loop, there is no dependence. */ loop, there is no dependence. */
if (x1 >= niter_a || y1 >= niter_b) if (x1 >= niter_a || y1 >= niter_b)
...@@ -3774,8 +3770,20 @@ analyze_subscript_affine_affine (tree chrec_a, ...@@ -3774,8 +3770,20 @@ analyze_subscript_affine_affine (tree chrec_a,
*last_conflicts = integer_zero_node; *last_conflicts = integer_zero_node;
goto end_analyze_subs_aa; goto end_analyze_subs_aa;
} }
/* max stmt executions can get quite large, avoid
overflows by using wide ints here. */
widest_int tau2
= wi::smin (wi::sdiv_floor (wi::sub (niter_a, i0), i1),
wi::sdiv_floor (wi::sub (niter_b, j0), j1));
widest_int last_conflict = wi::sub (tau2, (x1 - i0)/i1);
if (wi::min_precision (last_conflict, SIGNED)
<= TYPE_PRECISION (integer_type_node))
*last_conflicts
= build_int_cst (integer_type_node,
last_conflict.to_shwi ());
else else
*last_conflicts = build_int_cst (NULL_TREE, last_conflict); *last_conflicts = chrec_dont_know;
} }
else else
*last_conflicts = chrec_dont_know; *last_conflicts = chrec_dont_know;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment