aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorBin Cheng <bin.cheng@arm.com>2015-07-16 05:49:47 +0000
committerBin Cheng <amker@gcc.gnu.org>2015-07-16 05:49:47 +0000
commit4c3b378b5a9ddba3a66fa24203df5e850b4de3d6 (patch)
tree2260573a0b7e5807d0b3e1d91f4a27562a6dc69e /gcc/tree-ssa-loop-ivopts.c
parenta6885f12c73d525ad577fb5c2ae4a7c94ab53e31 (diff)
downloadgcc-4c3b378b5a9ddba3a66fa24203df5e850b4de3d6.zip
gcc-4c3b378b5a9ddba3a66fa24203df5e850b4de3d6.tar.gz
gcc-4c3b378b5a9ddba3a66fa24203df5e850b4de3d6.tar.bz2
tree-ssa-loop-ivopts.c (add_candidate): Remove call to add_autoinc_candidates.
* tree-ssa-loop-ivopts.c (add_candidate): Remove call to add_autoinc_candidates. (add_iv_candidate_for_biv): Rename to add_iv_candidate_for_biv. (add_iv_candidate_for_biv): Rename from add_iv_candidate_for_biv. (add_old_ivs_candidates): Rename to add_iv_candidate_for_bivs. (add_iv_candidate_for_bivs): Rename from add_old_ivs_candidates. Call new function. (add_iv_value_candidates): Rename to add_iv_candidate_for_use. (add_iv_candidate_for_use): Rename from add_iv_value_candidates. Remove parameter struct iv*. Call add_autoinc_candidates here. (add_derived_ivs_candidates): Rename to add_iv_candidate_for_uses. (add_iv_candidate_for_uses): Rename from add_derived_ivs_candidates. Call new function. (find_iv_candidates): Call new functions. From-SVN: r225859
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 67f24c4..6bce3a1 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -2788,7 +2788,8 @@ add_autoinc_candidates (struct ivopts_data *data, tree base, tree step,
/* Adds a candidate BASE + STEP * i. Important field is set to IMPORTANT and
position to POS. If USE is not NULL, the candidate is set as related to
- it. The candidate computation is scheduled on all available positions. */
+ it. The candidate computation is scheduled before exit condition and at
+ the end of loop. */
static void
add_candidate (struct ivopts_data *data,
@@ -2801,9 +2802,6 @@ add_candidate (struct ivopts_data *data,
if (ip_end_pos (data->current_loop)
&& allow_ip_end_pos_p (data->current_loop))
add_candidate_1 (data, base, step, important, IP_END, use, NULL);
-
- if (use != NULL && use->type == USE_ADDRESS)
- add_autoinc_candidates (data, base, step, important, use);
}
/* Adds standard iv candidates. */
@@ -2832,7 +2830,7 @@ add_standard_iv_candidates (struct ivopts_data *data)
/* Adds candidates bases on the old induction variable IV. */
static void
-add_old_iv_candidates (struct ivopts_data *data, struct iv *iv)
+add_iv_candidate_for_biv (struct ivopts_data *data, struct iv *iv)
{
gimple phi;
tree def;
@@ -2872,7 +2870,7 @@ add_old_iv_candidates (struct ivopts_data *data, struct iv *iv)
/* Adds candidates based on the old induction variables. */
static void
-add_old_ivs_candidates (struct ivopts_data *data)
+add_iv_candidate_for_bivs (struct ivopts_data *data)
{
unsigned i;
struct iv *iv;
@@ -2882,19 +2880,19 @@ add_old_ivs_candidates (struct ivopts_data *data)
{
iv = ver_info (data, i)->iv;
if (iv && iv->biv_p && !integer_zerop (iv->step))
- add_old_iv_candidates (data, iv);
+ add_iv_candidate_for_biv (data, iv);
}
}
-/* Adds candidates based on the value of the induction variable IV and USE. */
+/* Adds candidates based on the value of USE's iv. */
static void
-add_iv_value_candidates (struct ivopts_data *data,
- struct iv *iv, struct iv_use *use)
+add_iv_candidate_for_use (struct ivopts_data *data, struct iv_use *use)
{
unsigned HOST_WIDE_INT offset;
tree base;
tree basetype;
+ struct iv *iv = use->iv;
add_candidate (data, iv->base, iv->step, false, use);
@@ -2904,21 +2902,25 @@ add_iv_value_candidates (struct ivopts_data *data,
basetype = TREE_TYPE (iv->base);
if (POINTER_TYPE_P (basetype))
basetype = sizetype;
- add_candidate (data, build_int_cst (basetype, 0),
- iv->step, true, use);
+ add_candidate (data, build_int_cst (basetype, 0), iv->step, true, use);
/* Third, try removing the constant offset. Make sure to even
add a candidate for &a[0] vs. (T *)&a. */
base = strip_offset (iv->base, &offset);
- if (offset
- || base != iv->base)
+ if (offset || base != iv->base)
add_candidate (data, base, iv->step, false, use);
+
+ /* At last, add auto-incremental candidates. Make such variables
+ important since other iv uses with same base object may be based
+ on it. */
+ if (use != NULL && use->type == USE_ADDRESS)
+ add_autoinc_candidates (data, iv->base, iv->step, true, use);
}
/* Adds candidates based on the uses. */
static void
-add_derived_ivs_candidates (struct ivopts_data *data)
+add_iv_candidate_for_uses (struct ivopts_data *data)
{
unsigned i;
@@ -2935,7 +2937,7 @@ add_derived_ivs_candidates (struct ivopts_data *data)
case USE_COMPARE:
case USE_ADDRESS:
/* Just add the ivs based on the value of the iv used here. */
- add_iv_value_candidates (data, use->iv, use);
+ add_iv_candidate_for_use (data, use);
break;
default:
@@ -5320,10 +5322,10 @@ find_iv_candidates (struct ivopts_data *data)
add_standard_iv_candidates (data);
/* Add old induction variables. */
- add_old_ivs_candidates (data);
+ add_iv_candidate_for_bivs (data);
/* Add induction variables derived from uses. */
- add_derived_ivs_candidates (data);
+ add_iv_candidate_for_uses (data);
set_autoinc_for_original_candidates (data);