diff options
author | Richard Biener <rguenther@suse.de> | 2014-08-15 07:50:40 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-08-15 07:50:40 +0000 |
commit | 6e2028ff0f24561125d465b3c8d6acc88d4d82dc (patch) | |
tree | d715e9fb4a2949aee3ce02f70c58ffb10d618df5 /gcc/tree-data-ref.c | |
parent | 94351473749ce2618a1f2193380c0d690f9d6bb8 (diff) | |
download | gcc-6e2028ff0f24561125d465b3c8d6acc88d4d82dc.zip gcc-6e2028ff0f24561125d465b3c8d6acc88d4d82dc.tar.gz gcc-6e2028ff0f24561125d465b3c8d6acc88d4d82dc.tar.bz2 |
re PR tree-optimization/62031 (Different results between O2 and O2 -fpredictive-commoning)
2014-08-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/62031
* tree-data-ref.c (dr_analyze_indices): Do not set
DR_UNCONSTRAINED_BASE.
(dr_may_alias_p): All indirect accesses have to go the
formerly DR_UNCONSTRAINED_BASE path.
* tree-data-ref.h (struct indices): Remove
unconstrained_base member.
(DR_UNCONSTRAINED_BASE): Remove.
* gcc.dg/torture/pr62031.c: New testcase.
From-SVN: r214006
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r-- | gcc/tree-data-ref.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 55dbf6a..1d3efa6 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -982,7 +982,6 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop) ref = fold_build2_loc (EXPR_LOCATION (ref), MEM_REF, TREE_TYPE (ref), base, memoff); - DR_UNCONSTRAINED_BASE (dr) = true; access_fns.safe_push (access_fn); } } @@ -1389,14 +1388,20 @@ dr_may_alias_p (const struct data_reference *a, const struct data_reference *b, return false; } - /* If we had an evolution in a MEM_REF BASE_OBJECT we do not know - the size of the base-object. So we cannot do any offset/overlap - based analysis but have to rely on points-to information only. */ + /* If we had an evolution in a pointer-based MEM_REF BASE_OBJECT we + do not know the size of the base-object. So we cannot do any + offset/overlap based analysis but have to rely on points-to + information only. */ if (TREE_CODE (addr_a) == MEM_REF - && DR_UNCONSTRAINED_BASE (a)) + && TREE_CODE (TREE_OPERAND (addr_a, 0)) == SSA_NAME) { - if (TREE_CODE (addr_b) == MEM_REF - && DR_UNCONSTRAINED_BASE (b)) + /* For true dependences we can apply TBAA. */ + if (flag_strict_aliasing + && DR_IS_WRITE (a) && DR_IS_READ (b) + && !alias_sets_conflict_p (get_alias_set (DR_REF (a)), + get_alias_set (DR_REF (b)))) + return false; + if (TREE_CODE (addr_b) == MEM_REF) return ptr_derefs_may_alias_p (TREE_OPERAND (addr_a, 0), TREE_OPERAND (addr_b, 0)); else @@ -1404,9 +1409,21 @@ dr_may_alias_p (const struct data_reference *a, const struct data_reference *b, build_fold_addr_expr (addr_b)); } else if (TREE_CODE (addr_b) == MEM_REF - && DR_UNCONSTRAINED_BASE (b)) - return ptr_derefs_may_alias_p (build_fold_addr_expr (addr_a), - TREE_OPERAND (addr_b, 0)); + && TREE_CODE (TREE_OPERAND (addr_b, 0)) == SSA_NAME) + { + /* For true dependences we can apply TBAA. */ + if (flag_strict_aliasing + && DR_IS_WRITE (a) && DR_IS_READ (b) + && !alias_sets_conflict_p (get_alias_set (DR_REF (a)), + get_alias_set (DR_REF (b)))) + return false; + if (TREE_CODE (addr_a) == MEM_REF) + return ptr_derefs_may_alias_p (TREE_OPERAND (addr_a, 0), + TREE_OPERAND (addr_b, 0)); + else + return ptr_derefs_may_alias_p (build_fold_addr_expr (addr_a), + TREE_OPERAND (addr_b, 0)); + } /* Otherwise DR_BASE_OBJECT is an access that covers the whole object that is being subsetted in the loop nest. */ |