diff options
author | Richard Guenther <rguenther@suse.de> | 2010-11-02 17:00:09 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-11-02 17:00:09 +0000 |
commit | 343b2efcd766d7d56016c0ae85b6eb13d9597b9e (patch) | |
tree | 118e06f401c39f90636e55426945c6793d29860a /gcc/tree-ssa-structalias.c | |
parent | f26aa48e06db4d1e6724bfbc52ba466965719668 (diff) | |
download | gcc-343b2efcd766d7d56016c0ae85b6eb13d9597b9e.zip gcc-343b2efcd766d7d56016c0ae85b6eb13d9597b9e.tar.gz gcc-343b2efcd766d7d56016c0ae85b6eb13d9597b9e.tar.bz2 |
re PR tree-optimization/46149 (26_numerics/valarray/27867.cc FAILs with -O2 -fno-tree-sra)
2010-11-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46149
* tree-ssa-structalias.c (get_constraint_for_1): Properly handle
non-indirect MEM_REF variants.
* g++.dg/torture/pr46149.C: New testcase.
From-SVN: r166204
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index ed05178..315bef6 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -3339,9 +3339,41 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p, { case MEM_REF: { + struct constraint_expr *c; + varinfo_t vi, curr; tree off = double_int_to_tree (sizetype, mem_ref_offset (t)); get_constraint_for_ptr_offset (TREE_OPERAND (t, 0), off, results); do_deref (results); + + /* If we are not taking the address then make sure to process + all subvariables we might access. */ + c = VEC_last (ce_s, *results); + if (address_p + || c->type != SCALAR) + return; + + vi = get_varinfo (c->var); + curr = vi->next; + if (!vi->is_full_var + && curr) + { + unsigned HOST_WIDE_INT size; + if (host_integerp (TYPE_SIZE (TREE_TYPE (t)), 1)) + size = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (t))); + else + size = -1; + for (; curr; curr = curr->next) + { + if (curr->offset - vi->offset < size) + { + struct constraint_expr cs = *c; + cs.var = curr->id; + VEC_safe_push (ce_s, heap, *results, &cs); + } + else + break; + } + } return; } case ARRAY_REF: |