diff options
author | Roger Sayle <sayle@gcc.gnu.org> | 2006-09-18 01:54:33 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2006-09-18 01:54:33 +0000 |
commit | aac8b8ed8a1f8a2f26ebdad86824600f828bf8cc (patch) | |
tree | 75f098e9bc265156e2b16c0f13768b250a6693ea /gcc/tree-ssa-loop-prefetch.c | |
parent | 8e77de24deed6692b43b91bc753d3d78895527cd (diff) | |
download | gcc-aac8b8ed8a1f8a2f26ebdad86824600f828bf8cc.tar.gz |
re PR tree-optimization/28887 (rejects valid code (bitfields and loops) with -O1 -fprefetch-loop-arrays)
2006-09-17 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/28887
* tree-ssa-loop-prefetch.c (analyze_ref): Strip nonaddressable
component parts from the reference.
(gather_memory_references_ref): Record the reference without the
nonaddressable component parts.
* gcc.dg/prefetch-loop-arrays-1.c: New test case.
From-SVN: r117012
Diffstat (limited to 'gcc/tree-ssa-loop-prefetch.c')
-rw-r--r-- | gcc/tree-ssa-loop-prefetch.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index 9340bbb4029..f9fe2d30c8a 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -387,18 +387,20 @@ idx_analyze_ref (tree base, tree *index, void *data) return true; } -/* Tries to express REF in shape &BASE + STEP * iter + DELTA, where DELTA and +/* Tries to express REF_P in shape &BASE + STEP * iter + DELTA, where DELTA and STEP are integer constants and iter is number of iterations of LOOP. The - reference occurs in statement STMT. */ + reference occurs in statement STMT. Strips nonaddressable component + references from REF_P. */ static bool -analyze_ref (struct loop *loop, tree ref, tree *base, +analyze_ref (struct loop *loop, tree *ref_p, tree *base, HOST_WIDE_INT *step, HOST_WIDE_INT *delta, tree stmt) { struct ar_data ar_data; tree off; HOST_WIDE_INT bit_offset; + tree ref = *ref_p; *step = 0; *delta = 0; @@ -408,6 +410,8 @@ analyze_ref (struct loop *loop, tree ref, tree *base, && DECL_NONADDRESSABLE_P (TREE_OPERAND (ref, 1))) ref = TREE_OPERAND (ref, 0); + *ref_p = ref; + for (; TREE_CODE (ref) == COMPONENT_REF; ref = TREE_OPERAND (ref, 0)) { off = DECL_FIELD_BIT_OFFSET (TREE_OPERAND (ref, 1)); @@ -436,7 +440,7 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs, HOST_WIDE_INT step, delta; struct mem_ref_group *agrp; - if (!analyze_ref (loop, ref, &base, &step, &delta, stmt)) + if (!analyze_ref (loop, &ref, &base, &step, &delta, stmt)) return; /* Now we know that REF = &BASE + STEP * iter + DELTA, where DELTA and STEP |