summaryrefslogtreecommitdiff
path: root/gcc/alias.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-19 12:34:45 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-19 12:34:45 +0000
commit7a3cf64d1c7e20a388744ef929a805d33c7cd07e (patch)
tree75a7d1ce1a175bc96655f4cf67f8ea84e0f07f16 /gcc/alias.c
parent8be55b3302098469b241defb77f4e3cb921578f7 (diff)
downloadgcc-7a3cf64d1c7e20a388744ef929a805d33c7cd07e.tar.gz
PR rtl-optimization/68955
PR rtl-optimization/64557 * dse.c (record_store, check_mem_read_rtx): Don't call get_addr here. Fix up formatting. * alias.c (get_addr): Handle VALUE +/- CONST_SCALAR_INT_P. * gcc.dg/torture/pr68955.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232554 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/alias.c')
-rw-r--r--gcc/alias.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/alias.c b/gcc/alias.c
index 352ae091194..d3273e8e852 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2193,8 +2193,8 @@ refs_newer_value_p (const_rtx expr, rtx v)
}
/* Convert the address X into something we can use. This is done by returning
- it unchanged unless it is a value; in the latter case we call cselib to get
- a more useful rtx. */
+ it unchanged unless it is a VALUE or VALUE +/- constant; for VALUE
+ we call cselib to get a more useful rtx. */
rtx
get_addr (rtx x)
@@ -2203,7 +2203,23 @@ get_addr (rtx x)
struct elt_loc_list *l;
if (GET_CODE (x) != VALUE)
- return x;
+ {
+ if ((GET_CODE (x) == PLUS || GET_CODE (x) == MINUS)
+ && GET_CODE (XEXP (x, 0)) == VALUE
+ && CONST_SCALAR_INT_P (XEXP (x, 1)))
+ {
+ rtx op0 = get_addr (XEXP (x, 0));
+ if (op0 != XEXP (x, 0))
+ {
+ if (GET_CODE (x) == PLUS
+ && GET_CODE (XEXP (x, 1)) == CONST_INT)
+ return plus_constant (GET_MODE (x), op0, INTVAL (XEXP (x, 1)));
+ return simplify_gen_binary (GET_CODE (x), GET_MODE (x),
+ op0, XEXP (x, 1));
+ }
+ }
+ return x;
+ }
v = CSELIB_VAL_PTR (x);
if (v)
{