summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-prefetch.c
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-25 11:18:07 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-25 11:18:07 +0000
commitf547ca129ab797b6b3a5c98d6ebc3b93254104a6 (patch)
tree40f47cc3c195e5fad0387d27e2b9762a3e6a78b0 /gcc/tree-ssa-loop-prefetch.c
parent1ebc0b9fafdce287709fdb04127f946e995ea640 (diff)
downloadgcc-f547ca129ab797b6b3a5c98d6ebc3b93254104a6.tar.gz
2010-05-25 Christian Borntraeger <borntraeger@de.ibm.com>
PR 44203 * tree-ssa-loop-prefetch.c: Fix logic for step calculation to match the original (and intended) behaviour before r159557. This changeset changed a=a+b*c to a=(a+b)*b which was obviously wrong in two ways. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159816 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-prefetch.c')
-rw-r--r--gcc/tree-ssa-loop-prefetch.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 633dd337c74..d63ede1bbe9 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -423,25 +423,24 @@ idx_analyze_ref (tree base, tree *index, void *data)
ibase = build_int_cst (TREE_TYPE (ibase), 0);
}
- if (*ar_data->step == NULL_TREE)
- *ar_data->step = step;
- else
- *ar_data->step = fold_build2 (PLUS_EXPR, sizetype,
- fold_convert (sizetype, *ar_data->step),
- fold_convert (sizetype, step));
if (TREE_CODE (base) == ARRAY_REF)
{
stepsize = array_ref_element_size (base);
if (!cst_and_fits_in_hwi (stepsize))
return false;
imult = int_cst_value (stepsize);
-
- *ar_data->step = fold_build2 (MULT_EXPR, sizetype,
- fold_convert (sizetype, *ar_data->step),
- fold_convert (sizetype, step));
+ step = fold_build2 (MULT_EXPR, sizetype,
+ fold_convert (sizetype, step),
+ fold_convert (sizetype, stepsize));
idelta *= imult;
}
+ if (*ar_data->step == NULL_TREE)
+ *ar_data->step = step;
+ else
+ *ar_data->step = fold_build2 (PLUS_EXPR, sizetype,
+ fold_convert (sizetype, *ar_data->step),
+ fold_convert (sizetype, step));
*ar_data->delta += idelta;
*index = ibase;