diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-07-02 13:54:09 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-07-02 13:54:09 +0200 |
commit | c4e87a1393f9829ca9cbd2066501a0bce5f0be38 (patch) | |
tree | 536b79dc2d2049d0001860af4f3197fa19933676 /gcc/tree-vect-loop.c | |
parent | f8411fcce91e66df8d6dae01b1e6444e57428228 (diff) | |
download | gcc-c4e87a1393f9829ca9cbd2066501a0bce5f0be38.zip gcc-c4e87a1393f9829ca9cbd2066501a0bce5f0be38.tar.gz gcc-c4e87a1393f9829ca9cbd2066501a0bce5f0be38.tar.bz2 |
re PR tree-optimization/57741 (ICE in tree.c:build_int_cst_wide starting in revision 200394)
PR tree-optimization/57741
* tree-vect-loop.c (vect_is_simple_iv_evolution): Disallow
non-INTEGRAL_TYPE_P non-SCALAR_FLOAT_TYPE_P SSA_NAME step_exprs,
or SCALAR_FLOAT_TYPE_P SSA_NAMEs if !flag_associative_math.
Allow REAL_CST step_exprs if flag_associative_math.
(get_initial_def_for_induction): Handle SCALAR_FLOAT_TYPE_P step_expr.
* gcc.dg/vect/pr57741-1.c: New test.
* gcc.dg/vect/pr57741-2.c: New test.
* gcc.dg/vect/pr57741-3.c: New test.
From-SVN: r200600
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index c9b1021..41eac97 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -538,7 +538,12 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init, if (TREE_CODE (step_expr) != INTEGER_CST && (TREE_CODE (step_expr) != SSA_NAME || ((bb = gimple_bb (SSA_NAME_DEF_STMT (step_expr))) - && flow_bb_inside_loop_p (get_loop (cfun, loop_nb), bb)))) + && flow_bb_inside_loop_p (get_loop (cfun, loop_nb), bb)) + || (!INTEGRAL_TYPE_P (TREE_TYPE (step_expr)) + && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE (step_expr)) + || !flag_associative_math))) + && (TREE_CODE (step_expr) != REAL_CST + || !flag_associative_math)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -3276,7 +3281,13 @@ get_initial_def_for_induction (gimple iv_phi) { /* iv_loop is the loop to be vectorized. Generate: vec_step = [VF*S, VF*S, VF*S, VF*S] */ - expr = build_int_cst (TREE_TYPE (step_expr), vf); + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (step_expr))) + { + expr = build_int_cst (integer_type_node, vf); + expr = fold_convert (TREE_TYPE (step_expr), expr); + } + else + expr = build_int_cst (TREE_TYPE (step_expr), vf); new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr), expr, step_expr); if (TREE_CODE (step_expr) == SSA_NAME) @@ -3339,7 +3350,13 @@ get_initial_def_for_induction (gimple iv_phi) gcc_assert (!nested_in_vect_loop); /* Create the vector that holds the step of the induction. */ - expr = build_int_cst (TREE_TYPE (step_expr), nunits); + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (step_expr))) + { + expr = build_int_cst (integer_type_node, nunits); + expr = fold_convert (TREE_TYPE (step_expr), expr); + } + else + expr = build_int_cst (TREE_TYPE (step_expr), nunits); new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr), expr, step_expr); if (TREE_CODE (step_expr) == SSA_NAME) |