Commit c456a94a by Zdenek Dvorak Committed by Zdenek Dvorak

re PR tree-optimization/21963 (ICE (seg fault) with -m64 (in IV-OPTS))

	PR tree-optimization/21963
	* tree-ssa-loop-ivopts.c (get_computation_aff): Use
	constant_multiple_of in the same way get_computation_cost_at does.

From-SVN: r101654
parent 8ec11fe9
2005-07-06 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/21963
* tree-ssa-loop-ivopts.c (get_computation_aff): Use
constant_multiple_of in the same way get_computation_cost_at does.
2005-07-06 Jakub Jelinek <jakub@redhat.com> 2005-07-06 Jakub Jelinek <jakub@redhat.com>
* config/sparc/sparc.h (sparc_compare_emitted): New extern. * config/sparc/sparc.h (sparc_compare_emitted): New extern.
......
...@@ -2983,6 +2983,7 @@ get_computation_aff (struct loop *loop, ...@@ -2983,6 +2983,7 @@ get_computation_aff (struct loop *loop,
unsigned HOST_WIDE_INT ustepi, cstepi; unsigned HOST_WIDE_INT ustepi, cstepi;
HOST_WIDE_INT ratioi; HOST_WIDE_INT ratioi;
struct affine_tree_combination cbase_aff, expr_aff; struct affine_tree_combination cbase_aff, expr_aff;
tree cstep_orig = cstep, ustep_orig = ustep;
if (TYPE_PRECISION (utype) > TYPE_PRECISION (ctype)) if (TYPE_PRECISION (utype) > TYPE_PRECISION (ctype))
{ {
...@@ -3012,13 +3013,18 @@ get_computation_aff (struct loop *loop, ...@@ -3012,13 +3013,18 @@ get_computation_aff (struct loop *loop,
expr = fold_convert (uutype, expr); expr = fold_convert (uutype, expr);
cbase = fold_convert (uutype, cbase); cbase = fold_convert (uutype, cbase);
cstep = fold_convert (uutype, cstep); cstep = fold_convert (uutype, cstep);
/* If the conversion is not noop, we must take it into account when
considering the value of the step. */
if (TYPE_PRECISION (utype) < TYPE_PRECISION (ctype))
cstep_orig = cstep;
} }
if (cst_and_fits_in_hwi (cstep) if (cst_and_fits_in_hwi (cstep_orig)
&& cst_and_fits_in_hwi (ustep)) && cst_and_fits_in_hwi (ustep_orig))
{ {
ustepi = int_cst_value (ustep); ustepi = int_cst_value (ustep_orig);
cstepi = int_cst_value (cstep); cstepi = int_cst_value (cstep_orig);
if (!divide (TYPE_PRECISION (uutype), ustepi, cstepi, &ratioi)) if (!divide (TYPE_PRECISION (uutype), ustepi, cstepi, &ratioi))
{ {
...@@ -3032,7 +3038,7 @@ get_computation_aff (struct loop *loop, ...@@ -3032,7 +3038,7 @@ get_computation_aff (struct loop *loop,
} }
else else
{ {
ratio = constant_multiple_of (uutype, ustep, cstep); ratio = constant_multiple_of (uutype, ustep_orig, cstep_orig);
if (!ratio) if (!ratio)
return false; return false;
......
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