diff options
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 1e6d17e..8e1c53a 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -881,18 +881,16 @@ static tree determine_biv_step (tree phi) { struct loop *loop = bb_for_stmt (phi)->loop_father; - tree name = PHI_RESULT (phi), base, step; + tree name = PHI_RESULT (phi); + affine_iv iv; if (!is_gimple_reg (name)) return NULL_TREE; - if (!simple_iv (loop, phi, name, &base, &step, true)) + if (!simple_iv (loop, phi, name, &iv, true)) return NULL_TREE; - if (zero_p (step)) - return NULL_TREE; - - return step; + return (zero_p (iv.step) ? NULL_TREE : iv.step); } /* Returns true if EXP is a ssa name that occurs in an abnormal phi node. */ @@ -1044,17 +1042,16 @@ mark_bivs (struct ivopts_data *data) } /* Checks whether STMT defines a linear induction variable and stores its - parameters to BASE and STEP. */ + parameters to IV. */ static bool -find_givs_in_stmt_scev (struct ivopts_data *data, tree stmt, - tree *base, tree *step) +find_givs_in_stmt_scev (struct ivopts_data *data, tree stmt, affine_iv *iv) { tree lhs; struct loop *loop = data->current_loop; - *base = NULL_TREE; - *step = NULL_TREE; + iv->base = NULL_TREE; + iv->step = NULL_TREE; if (TREE_CODE (stmt) != MODIFY_EXPR) return false; @@ -1063,12 +1060,12 @@ find_givs_in_stmt_scev (struct ivopts_data *data, tree stmt, if (TREE_CODE (lhs) != SSA_NAME) return false; - if (!simple_iv (loop, stmt, TREE_OPERAND (stmt, 1), base, step, true)) + if (!simple_iv (loop, stmt, TREE_OPERAND (stmt, 1), iv, true)) return false; - *base = expand_simple_operations (*base); + iv->base = expand_simple_operations (iv->base); - if (contains_abnormal_ssa_name_p (*base) - || contains_abnormal_ssa_name_p (*step)) + if (contains_abnormal_ssa_name_p (iv->base) + || contains_abnormal_ssa_name_p (iv->step)) return false; return true; @@ -1079,12 +1076,12 @@ find_givs_in_stmt_scev (struct ivopts_data *data, tree stmt, static void find_givs_in_stmt (struct ivopts_data *data, tree stmt) { - tree base, step; + affine_iv iv; - if (!find_givs_in_stmt_scev (data, stmt, &base, &step)) + if (!find_givs_in_stmt_scev (data, stmt, &iv)) return; - set_iv (data, TREE_OPERAND (stmt, 0), base, step); + set_iv (data, TREE_OPERAND (stmt, 0), iv.base, iv.step); } /* Finds general ivs in basic block BB. */ |