diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index aeda6588bcd8ee0959c22e7fecb10ee30a8b25ec..6891156b5aaa6cdc7d43e536a74e077e216eef0c 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -781,8 +781,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops, case CT_SPECIAL_MEMORY: insn_allows_mem[i] = allows_mem[i] = 1; - if (MEM_P (extract_mem_from_operand (op)) - && constraint_satisfied_p (op, cn)) + if (MEM_P (op) && constraint_satisfied_p (op, cn)) win = 1; break; @@ -1398,16 +1397,15 @@ record_operand_costs (rtx_insn *insn, enum reg_class *pref) commutative. */ for (i = 0; i < recog_data.n_operands; i++) { - rtx op_mem = extract_mem_from_operand (recog_data.operand[i]); memcpy (op_costs[i], init_cost, struct_costs_size); if (GET_CODE (recog_data.operand[i]) == SUBREG) recog_data.operand[i] = SUBREG_REG (recog_data.operand[i]); - if (MEM_P (op_mem)) - record_address_regs (GET_MODE (op_mem), - MEM_ADDR_SPACE (op_mem), - XEXP (op_mem, 0), + if (MEM_P (recog_data.operand[i])) + record_address_regs (GET_MODE (recog_data.operand[i]), + MEM_ADDR_SPACE (recog_data.operand[i]), + XEXP (recog_data.operand[i], 0), 0, MEM, SCRATCH, frequency * 2); else if (constraints[i][0] == 'p' || (insn_extra_address_constraint diff --git a/gcc/ira.c b/gcc/ira.c index 7e4668c29f2fd208cdb701c34bdebb6720314a4f..681ec2f46f9d9c57b47ed740f6fbe78fb617216f 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -1868,7 +1868,7 @@ ira_setup_alts (rtx_insn *insn) case CT_MEMORY: case CT_SPECIAL_MEMORY: - if (MEM_P (extract_mem_from_operand (op))) + if (MEM_P (op)) goto op_success; win_p = true; break; @@ -5130,8 +5130,6 @@ move_unallocated_pseudos (void) INSN_UID (newinsn), i); SET_REG_N_REFS (i, 0); } - - first_moveable_pseudo = last_moveable_pseudo = 0; } /* If the backend knows where to allocate pseudos for hard diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index df75c7b947bba15293e7dbec184f719a3537c9ad..7cc479b30422e8c849447b02e9478e0eb42c5c13 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -409,34 +409,14 @@ valid_address_p (rtx op, struct address_info *ad, return valid_address_p (ad->mode, *ad->outer, ad->as); } -/* For special_memory_operand, it could be false for MEM_P (op), - i.e. bcst_mem_operand in i386 backend. - Extract and return real memory operand or op. */ -rtx -extract_mem_from_operand (rtx op) -{ - for (rtx x = op;; x = XEXP (x, 0)) - { - if (MEM_P (x)) - return x; - if (GET_RTX_LENGTH (GET_CODE (x)) != 1 - || GET_RTX_FORMAT (GET_CODE (x))[0] != 'e') - break; - } - return op; -} - /* Return true if the eliminated form of memory reference OP satisfies extra (special) memory constraint CONSTRAINT. */ static bool satisfies_memory_constraint_p (rtx op, enum constraint_num constraint) { struct address_info ad; - rtx mem = extract_mem_from_operand (op); - if (!MEM_P (mem)) - return false; - decompose_mem_address (&ad, mem); + decompose_mem_address (&ad, op); address_eliminator eliminator (&ad); return constraint_satisfied_p (op, constraint); } @@ -2364,7 +2344,8 @@ process_alt_operands (int only_alternative) break; case CT_MEMORY: - if (satisfies_memory_constraint_p (op, cn)) + if (MEM_P (op) + && satisfies_memory_constraint_p (op, cn)) win = true; else if (spilled_pseudo_p (op)) win = true; @@ -2405,7 +2386,8 @@ process_alt_operands (int only_alternative) break; case CT_SPECIAL_MEMORY: - if (satisfies_memory_constraint_p (op, cn)) + if (MEM_P (op) + && satisfies_memory_constraint_p (op, cn)) win = true; else if (spilled_pseudo_p (op)) win = true; diff --git a/gcc/recog.c b/gcc/recog.c index 8674054b95f838717d5947d03e5d5c8c410535f2..2720aaaac8595a723d2cf0efc4106e8860e3d405 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1798,8 +1798,7 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints) case CT_MEMORY: case CT_SPECIAL_MEMORY: /* Every memory operand can be reloaded to fit. */ - result = result || memory_operand (extract_mem_from_operand (op), - VOIDmode); + result = result || memory_operand (op, VOIDmode); break; case CT_ADDRESS: @@ -2585,9 +2584,7 @@ constrain_operands (int strict, alternative_mask alternatives) /* A unary operator may be accepted by the predicate, but it is irrelevant for matching constraints. */ - /* For special_memory_operand, there could be a memory operand inside, - and it would cause a mismatch for constraint_satisfied_p. */ - if (UNARY_P (op) && op == extract_mem_from_operand (op)) + if (UNARY_P (op)) op = XEXP (op, 0); if (GET_CODE (op) == SUBREG) diff --git a/gcc/rtl.h b/gcc/rtl.h index 35fb6ba73a02cf2a26e7b23e50ba6455983019a2..b29afca8d6b67db9870f00158a2b56e51e352a4e 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -4323,7 +4323,6 @@ extern rtx gen_hard_reg_clobber (machine_mode, unsigned int); extern rtx get_reg_known_value (unsigned int); extern bool get_reg_known_equiv_p (unsigned int); extern rtx get_reg_base_value (unsigned int); -extern rtx extract_mem_from_operand (rtx); #ifdef STACK_REGS extern int stack_regs_mentioned (const_rtx insn); diff --git a/gcc/testsuite/gcc.target/aarch64/nospill.c b/gcc/testsuite/gcc.target/aarch64/nospill.c deleted file mode 100644 index 968a4267e0d46192e4c59c098f787f5f4738a5e3..0000000000000000000000000000000000000000 --- a/gcc/testsuite/gcc.target/aarch64/nospill.c +++ /dev/null @@ -1,35 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O3" } */ - -/* The pseudo for P is marked as moveable in the IRA pass. */ -float -func_0 (float a, float b, float c) -{ - float p = c / a; - - if (b > 1) - { - b /= p; - if (c > 2) - a /= 3; - } - - return b / c * a; -} - -/* If first_moveable_pseudo and last_moveable_pseudo are not reset correctly, - they will carry over and spill the pseudo for Q. */ -float -func_1 (float a, float b, float c) -{ - float q = a + b; - - c *= a / (b + b); - if (a > 0) - c *= q; - - return a * b * c; -} - -/* We have plenty of spare registers, so check nothing has been spilled. */ -/* { dg-final { scan-assembler-not "\tstr\t" } } */