diff mbox series

[committed,PR99422] LRA: Use lookup_constraint only for a single constraint in process_address_1

Message ID 27547c3a-6d73-b83d-bef3-6d01ea8a64cb@redhat.com
State New
Headers show
Series [committed,PR99422] LRA: Use lookup_constraint only for a single constraint in process_address_1 | expand

Commit Message

Vladimir Makarov March 18, 2021, 8:03 p.m. UTC
This is an additional patch for PR99422:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99422

The patch was successfully bootstrapped and tested on x86-64, ppc64le, 
and aarch64.
diff mbox series

Patch

commit a4670f58ebff805e35268542aac35f9791980954
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Thu Mar 18 15:58:26 2021 -0400

    [PR99422] LRA: Use lookup_constraint only for a single constraint in process_address_1.
    
    This is an additional patch for PR99422.  In process_address_1 we
    look only at the first constraint in the 1st alternative
    and ignore all other possibilities.  As we don't know what
    alternative and constraint will be used at this stage, we can be sure
    only for a single constraint with one alternative and should use unknown
    constraint for all other cases.
    
    gcc/ChangeLog:
    
            PR target/99422
            * lra-constraints.c (process_address_1): Use lookup_constraint
            only for a single constraint.

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 9205826960c..64801b6fcce 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3459,7 +3459,12 @@  process_address_1 (int nop, bool check_only_p,
       constraint
 	= skip_contraint_modifiers (curr_static_id->operand[dup].constraint);
     }
-  cn = lookup_constraint (*constraint == '\0' ? "X" : constraint);
+  if (*skip_contraint_modifiers (constraint
+				 + CONSTRAINT_LEN (constraint[0],
+						   constraint)) != '\0')
+    cn = CONSTRAINT__UNKNOWN;
+  else
+    cn = lookup_constraint (*constraint == '\0' ? "X" : 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