From: Vladimir Makarov <vmakarov@redhat.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [committed] [PR99422] LRA: Skip modifiers when processing memory address.
Date: Mon, 8 Mar 2021 09:29:40 -0500 [thread overview]
Message-ID: <29852f3f-85d2-747f-437b-80b6749a725f@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 163 bytes --]
The following patch solves
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99422
The patch was successfully bootstrapped and tested on ppc64le, x86-64
and arm64.
[-- Attachment #2: pr99422.patch --]
[-- Type: text/x-patch, Size: 2203 bytes --]
commit 04b4828c6dd215385fde6964a5e13da8a01a78ba (HEAD -> master)
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date: Mon Mar 8 09:24:57 2021 -0500
[PR99422] LRA: Skip modifiers when processing memory address.
Function process_address_1 can wrongly look at constraint modifiers
instead of the 1st constraint itself. The patch solves the problem.
gcc/ChangeLog:
PR target/99422
* lra-constraints.c (skip_contraint_modifiers): New function.
(process_address_1): Use it before lookup_constraint call.
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 9253690561a..76e3ff7efe6 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3392,6 +3392,21 @@ equiv_address_substitution (struct address_info *ad)
return change_p;
}
+/* Skip all modifiers and whitespaces in constraint STR and return the
+ result. */
+static const char *
+skip_contraint_modifiers (const char *str)
+{
+ for (;;str++)
+ switch (*str)
+ {
+ case '+' : case '&' : case '=': case '*': case ' ': case '\t':
+ case '$': case '^' : case '%': case '?': case '!':
+ break;
+ default: return str;
+ }
+}
+
/* Major function to make reloads for an address in operand NOP or
check its correctness (If CHECK_ONLY_P is true). The supported
cases are:
@@ -3426,8 +3441,8 @@ process_address_1 (int nop, bool check_only_p,
HOST_WIDE_INT scale;
rtx op = *curr_id->operand_loc[nop];
rtx mem = extract_mem_from_operand (op);
- const char *constraint = curr_static_id->operand[nop].constraint;
- enum constraint_num cn = lookup_constraint (constraint);
+ const char *constraint;
+ enum constraint_num cn;
bool change_p = false;
if (MEM_P (mem)
@@ -3435,6 +3450,9 @@ process_address_1 (int nop, bool check_only_p,
&& GET_CODE (XEXP (mem, 0)) == SCRATCH)
return false;
+ constraint
+ = skip_contraint_modifiers (curr_static_id->operand[nop].constraint);
+ cn = lookup_constraint (constraint);
if (insn_extra_address_constraint (cn)
/* When we find an asm operand with an address constraint that
doesn't satisfy address_operand to begin with, we clear
reply other threads:[~2021-03-08 14:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29852f3f-85d2-747f-437b-80b6749a725f@redhat.com \
--to=vmakarov@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).