diff options
author | Jeff Law <law@redhat.com> | 2019-07-16 08:44:44 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2019-07-16 08:44:44 -0600 |
commit | f0593c53f3684f82b29f96b43393f5f39e890fed (patch) | |
tree | f11555575dbcc3b8c3656c20d41d508fb42b336c /gcc | |
parent | de2ad117f603491e404acb90510981aa27e087cc (diff) | |
download | gcc-f0593c53f3684f82b29f96b43393f5f39e890fed.zip gcc-f0593c53f3684f82b29f96b43393f5f39e890fed.tar.gz gcc-f0593c53f3684f82b29f96b43393f5f39e890fed.tar.bz2 |
re PR rtl-optimization/91173 (ICE: in int_mode_for_mode, at stor-layout.c:403)
PR rtl-optimization/91173
* tree-ssa-address.c (addr_for_mem_ref): If the base is an
SSA_NAME with a constant value, fold its value into the offset
and clear the base before calling gen_addr_rtx.
From-SVN: r273529
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/tree-ssa-address.c | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1eb2797..2bce569 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-07-16 Jeff Law <law@redhat.com> + + PR rtl-optimization/91173 + * tree-ssa-address.c (addr_for_mem_ref): If the base is an + SSA_NAME with a constant value, fold its value into the offset + and clear the base before calling gen_addr_rtx. + 2019-07-16 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/91164 diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index e83e1b9..8004951 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -259,6 +259,20 @@ addr_for_mem_ref (struct mem_address *addr, addr_space_t as, ? expand_expr (addr->index, NULL_RTX, pointer_mode, EXPAND_NORMAL) : NULL_RTX); + /* addr->base could be an SSA_NAME that was set to a constant value. The + call to expand_expr may expose that constant. If so, fold the value + into OFF and clear BSE. Otherwise we may later try to pull a mode from + BSE to generate a REG, which won't work with constants because they + are modeless. */ + if (bse && GET_CODE (bse) == CONST_INT) + { + if (off) + off = simplify_gen_binary (PLUS, pointer_mode, bse, off); + else + off = bse; + gcc_assert (GET_CODE (off) == CONST_INT); + bse = NULL_RTX; + } gen_addr_rtx (pointer_mode, sym, bse, idx, st, off, &address, NULL, NULL); if (pointer_mode != address_mode) address = convert_memory_address (address_mode, address); |