diff options
author | amker <amker@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-12 06:42:05 +0000 |
---|---|---|
committer | amker <amker@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-12 06:42:05 +0000 |
commit | 62d6df9a8334967dc12313f9dde4641c106a575b (patch) | |
tree | 8121aef024fc425b95d1a2e94170968717ce1c23 /gcc/tree-ssa-loop-ivopts.c | |
parent | ee4a81abd0cdb04fdf84ce3f8c86cddffbce7826 (diff) | |
download | gcc-62d6df9a8334967dc12313f9dde4641c106a575b.tar.gz |
* tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Refactor the code.
Handle type conversion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204695 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index f7da1267416..d024bb4c395 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3608,30 +3608,13 @@ force_expr_to_var_cost (tree expr, bool speed) op1 = TREE_OPERAND (expr, 1); STRIP_NOPS (op0); STRIP_NOPS (op1); - - if (is_gimple_val (op0)) - cost0 = no_cost; - else - cost0 = force_expr_to_var_cost (op0, speed); - - if (is_gimple_val (op1)) - cost1 = no_cost; - else - cost1 = force_expr_to_var_cost (op1, speed); - break; + CASE_CONVERT: case NEGATE_EXPR: op0 = TREE_OPERAND (expr, 0); STRIP_NOPS (op0); op1 = NULL_TREE; - - if (is_gimple_val (op0)) - cost0 = no_cost; - else - cost0 = force_expr_to_var_cost (op0, speed); - - cost1 = no_cost; break; default: @@ -3639,6 +3622,18 @@ force_expr_to_var_cost (tree expr, bool speed) return new_cost (target_spill_cost[speed], 0); } + if (op0 == NULL_TREE + || TREE_CODE (op0) == SSA_NAME || CONSTANT_CLASS_P (op0)) + cost0 = no_cost; + else + cost0 = force_expr_to_var_cost (op0, speed); + + if (op1 == NULL_TREE + || TREE_CODE (op1) == SSA_NAME || CONSTANT_CLASS_P (op1)) + cost1 = no_cost; + else + cost1 = force_expr_to_var_cost (op1, speed); + mode = TYPE_MODE (TREE_TYPE (expr)); switch (TREE_CODE (expr)) { @@ -3664,6 +3659,16 @@ force_expr_to_var_cost (tree expr, bool speed) } break; + CASE_CONVERT: + { + tree inner_mode, outer_mode; + outer_mode = TREE_TYPE (expr); + inner_mode = TREE_TYPE (op0); + cost = new_cost (convert_cost (TYPE_MODE (outer_mode), + TYPE_MODE (inner_mode), speed), 0); + } + break; + case MULT_EXPR: if (cst_and_fits_in_hwi (op0)) cost = new_cost (mult_by_coeff_cost (int_cst_value (op0), |