aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-09-18 07:57:00 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-09-18 07:57:00 +0000
commita0f79fcc43760c8b7f72eccc9686c6e5cb7995d9 (patch)
tree5b63093bcc6c103adf789191e978d64af6c25cd8 /gcc/fold-const.c
parent9ace6a87332fe24076e18706d8d2c7c9b56dcce9 (diff)
downloadgcc-a0f79fcc43760c8b7f72eccc9686c6e5cb7995d9.zip
gcc-a0f79fcc43760c8b7f72eccc9686c6e5cb7995d9.tar.gz
gcc-a0f79fcc43760c8b7f72eccc9686c6e5cb7995d9.tar.bz2
re PR tree-optimization/66142 (Loop is not vectorized because not sufficient support for GOMP_SIMD_LANE)
2015-09-18 Richard Biener <rguenther@suse.de> PR tree-optimization/66142 * fold-const.c (operand_equal_p): When OEP_ADDRESS_OF treat MEM[&x] and x the same. * tree-ssa-sccvn.h (vn_reference_fold_indirect): Remove. * tree-ssa-sccvn.c (vn_reference_fold_indirect): Return true when we simplified sth. (vn_reference_maybe_forwprop_address): Likewise. (valueize_refs_1): When we simplified through vn_reference_fold_indirect or vn_reference_maybe_forwprop_address set valueized_anything to true. (vn_reference_lookup_3): Use stmt_kills_ref_p to see whether one ref kills the other instead of just a offset-based test. * tree-ssa-alias.c (stmt_kills_ref_p): Use OEP_ADDRESS_OF for the operand_equal_p test to compare bases and also compare sizes. From-SVN: r227896
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index a27ef22..ce2c469 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2752,10 +2752,33 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
TREE_OPERAND (arg1, 0), flags);
}
- if (TREE_CODE (arg0) != TREE_CODE (arg1)
+ if (TREE_CODE (arg0) != TREE_CODE (arg1))
+ {
/* NOP_EXPR and CONVERT_EXPR are considered equal. */
- && !(CONVERT_EXPR_P (arg0) && CONVERT_EXPR_P (arg1)))
- return 0;
+ if (CONVERT_EXPR_P (arg0) && CONVERT_EXPR_P (arg1))
+ ;
+ else if (flags & OEP_ADDRESS_OF)
+ {
+ /* If we are interested in comparing addresses ignore
+ MEM_REF wrappings of the base that can appear just for
+ TBAA reasons. */
+ if (TREE_CODE (arg0) == MEM_REF
+ && DECL_P (arg1)
+ && TREE_CODE (TREE_OPERAND (arg0, 0)) == ADDR_EXPR
+ && TREE_OPERAND (TREE_OPERAND (arg0, 0), 0) == arg1
+ && integer_zerop (TREE_OPERAND (arg0, 1)))
+ return 1;
+ else if (TREE_CODE (arg1) == MEM_REF
+ && DECL_P (arg0)
+ && TREE_CODE (TREE_OPERAND (arg1, 0)) == ADDR_EXPR
+ && TREE_OPERAND (TREE_OPERAND (arg1, 0), 0) == arg0
+ && integer_zerop (TREE_OPERAND (arg1, 1)))
+ return 1;
+ return 0;
+ }
+ else
+ return 0;
+ }
/* This is needed for conversions and for COMPONENT_REF.
Might as well play it safe and always test this. */