From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1256) id 789C13858C27; Wed, 24 Nov 2021 13:37:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 789C13858C27 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Maciej W. Rozycki To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9306] PR middle-end/103059: reload: Also accept ASHIFT with indexed addressing X-Act-Checkin: gcc X-Git-Author: Maciej W. Rozycki X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 4abba33509339207d82b42cb3c16d3855a969ae6 X-Git-Newrev: 78421afafde5156d6d4c6c7073653e4b92f88e3d Message-Id: <20211124133705.789C13858C27@sourceware.org> Date: Wed, 24 Nov 2021 13:37:05 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2021 13:37:05 -0000 https://gcc.gnu.org/g:78421afafde5156d6d4c6c7073653e4b92f88e3d commit r11-9306-g78421afafde5156d6d4c6c7073653e4b92f88e3d Author: Maciej W. Rozycki Date: Wed Nov 24 13:15:06 2021 +0000 PR middle-end/103059: reload: Also accept ASHIFT with indexed addressing Correct a `vax-netbsdelf' target regression ultimately caused by commit c605a8bf9270 ("VAX: Accept ASHIFT in address expressions") (needed for LRA) and as of commit 4a960d548b7d ("Avoid invalid loop transformations in jump threading registry.") causing a build error in libgcc: .../libgcc/libgcov-driver.c: In function 'gcov_do_dump': .../libgcc/libgcov-driver.c:686:1: error: insn does not satisfy its constraints: 686 | } | ^ (insn 2051 2050 2052 185 (set (reg/f:SI 0 %r0 [555]) (plus:SI (ashift:SI (mem/c:SI (plus:SI (reg/f:SI 13 %fp) (const_int -28 [0xffffffffffffffe4])) [40 %sfp+-28 S4 A32]) (const_int 3 [0x3])) (plus:SI (reg/v/f:SI 9 %r9 [orig:176 fn_buffer ] [176]) (const_int 24 [0x18])))) ".../libgcc/libgcov-driver.c":172:40 614 {movaddrdi} (nil)) during RTL pass: postreload .../libgcc/libgcov-driver.c:686:1: internal compiler error: in extract_constrain_insn, at recog.c:2670 0x1122a5ff _fatal_insn(char const*, rtx_def const*, char const*, int, char const*) .../gcc/rtl-error.c:108 0x1122a697 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*) .../gcc/rtl-error.c:118 0x111b5f2f extract_constrain_insn(rtx_insn*) .../gcc/recog.c:2670 0x11143eef reload_cse_simplify_operands .../gcc/postreload.c:407 0x11142fdb reload_cse_simplify .../gcc/postreload.c:132 0x11143533 reload_cse_regs_1 .../gcc/postreload.c:238 0x11142ce7 reload_cse_regs .../gcc/postreload.c:66 0x1114af33 execute .../gcc/postreload.c:2355 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. This is because reload does not recognize the ASHIFT form of scaled indexed addressing that the offending commit enabled the backend to produce, and as seen in the RTL above lets the pseudo holding the index part become the original memory reference rather than reloading it into a hard register. Fix it then by adding said form to reload, removing the build failure and numerous similar regressions throughout `vax-netbsdelf' test suites run with the source as at right before the build regression. Cf. , and commit 6b3034eaba83 ("lra: Canonicalize mult to shift in address reloads"). gcc/ PR middle-end/103059 * reload.c (find_reloads_address_1): Also accept the ASHIFT form of indexed addressing. (find_reloads): Adjust accordingly. (cherry picked from commit 29e1cbdc0c6e7d3de10478ef2b881900545c2a55) Diff: --- gcc/reload.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/reload.c b/gcc/reload.c index e18e27c2405..2223d9cdbbc 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -2874,10 +2874,11 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known, i, operand_type[i], ind_levels, insn); /* If we now have a simple operand where we used to have a - PLUS or MULT, re-recognize and try again. */ + PLUS or MULT or ASHIFT, re-recognize and try again. */ if ((OBJECT_P (*recog_data.operand_loc[i]) || GET_CODE (*recog_data.operand_loc[i]) == SUBREG) && (GET_CODE (recog_data.operand[i]) == MULT + || GET_CODE (recog_data.operand[i]) == ASHIFT || GET_CODE (recog_data.operand[i]) == PLUS)) { INSN_CODE (insn) = -1; @@ -5600,7 +5601,8 @@ find_reloads_address_1 (machine_mode mode, addr_space_t as, return 1; } - if (code0 == MULT || code0 == SIGN_EXTEND || code0 == TRUNCATE + if (code0 == MULT || code0 == ASHIFT + || code0 == SIGN_EXTEND || code0 == TRUNCATE || code0 == ZERO_EXTEND || code1 == MEM) { find_reloads_address_1 (mode, as, orig_op0, 1, PLUS, SCRATCH, @@ -5611,7 +5613,8 @@ find_reloads_address_1 (machine_mode mode, addr_space_t as, insn); } - else if (code1 == MULT || code1 == SIGN_EXTEND || code1 == TRUNCATE + else if (code1 == MULT || code1 == ASHIFT + || code1 == SIGN_EXTEND || code1 == TRUNCATE || code1 == ZERO_EXTEND || code0 == MEM) { find_reloads_address_1 (mode, as, orig_op0, 0, PLUS, code1,