diff options
author | Richard Henderson <rth@redhat.com> | 2015-11-09 01:18:35 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2015-11-09 01:18:35 -0800 |
commit | bd68a3a7e74c8a034dab3efd84c09c4fed066fc1 (patch) | |
tree | 46bd72668958aed984a4145ddb893bf82b2a00da /gcc/fold-const.c | |
parent | f0ebde5acecc9fd69fd6dc1c8a9dd568edf96747 (diff) | |
download | gcc-bd68a3a7e74c8a034dab3efd84c09c4fed066fc1.zip gcc-bd68a3a7e74c8a034dab3efd84c09c4fed066fc1.tar.gz gcc-bd68a3a7e74c8a034dab3efd84c09c4fed066fc1.tar.bz2 |
Avoid CSE of MEMs in different address spaces
* cselib.c (add_mem_for_addr): Compare address spaces when
matching memories.
(cselib_lookup_mem): Likewise.
* fold-const.c (operand_equal_p): Check address spaces of
pointer types before checking integer constants.
From-SVN: r229998
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5e32901..d8a45d9 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2697,6 +2697,13 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) if (!TREE_TYPE (arg0) || !TREE_TYPE (arg1)) return 0; + /* We cannot consider pointers to different address space equal. */ + if (POINTER_TYPE_P (TREE_TYPE (arg0)) + && POINTER_TYPE_P (TREE_TYPE (arg1)) + && (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg0))) + != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg1))))) + return 0; + /* Check equality of integer constants before bailing out due to precision differences. */ if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST) @@ -2719,13 +2726,6 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) != POINTER_TYPE_P (TREE_TYPE (arg1))) return 0; - /* We cannot consider pointers to different address space equal. */ - if (POINTER_TYPE_P (TREE_TYPE (arg0)) - && POINTER_TYPE_P (TREE_TYPE (arg1)) - && (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg0))) - != TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg1))))) - return 0; - /* If both types don't have the same precision, then it is not safe to strip NOPs. */ if (element_precision (TREE_TYPE (arg0)) |