https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97532
--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Jakub Jelinek from comment #7)
> memory_operand calls general_operand which for MEM does:
> /* Use the mem's mode, since it will be reloaded thus. LRA can
> generate move insn with invalid addresses which is made valid
> and efficiently calculated by LRA through further numerous
> transformations. */
> if (lra_in_progress
> || memory_address_addr_space_p (GET_MODE (op), y, MEM_ADDR_SPACE
> (op)))
> return 1;
> So, during LRA it accepts anything, and at the end of LRA it ICEs because it
> isn't recognized.
> So, I think LRA needs to know somewhere what is the address operand of the
> MEM even inside of the bcst_mem_operand and know that it should fix it up.
Yes, and i saw at least two places needed to be adjusted.
First in process_address_1 (int nop, bool check_only_p,
---
3430 /* Do not attempt to decompose arbitrary addresses generated by combine
3431 for asm operands with loose constraints, e.g 'X'. */
3432 else if (MEM_P (op) ---------------------------------------> Here!!!
3433 && !(INSN_CODE (curr_insn) < 0
3434 && get_constraint_type (cn) == CT_FIXED_FORM
3435 && constraint_satisfied_p (op, cn)))
3436 decompose_mem_address (&ad, op);
3437 else if (GET_CODE (op) == SUBREG
3438 && MEM_P (SUBREG_REG (op)))
3439 decompose_mem_address (&ad, SUBREG_REG (op));
3440 else
3441 return false;
---
Then in valid_address_p which would be called in process_address_1
---
398 /* Return true if the eliminated form of AD is a legitimate target
address.
399 If OP is a MEM, AD is the address within OP, otherwise OP should be
400 ignored. CONSTRAINT is one constraint that the operand may need
401 to meet. */
402 static bool
403 valid_address_p (rtx op, struct address_info *ad,
404 enum constraint_num constraint)
405 {
406 address_eliminator eliminator (ad);
407
408 /* Allow a memory OP if it matches CONSTRAINT, even if CONSTRAINT is
more
409 forgiving than "m". */
410 if (MEM_P (op) -----------------------------------------------> Here.
411 && (insn_extra_memory_constraint (constraint)
412 || insn_extra_special_memory_constraint (constraint))
413 && constraint_satisfied_p (op, constraint))
414 return true;
415
416 return valid_address_p (ad->mode, *ad->outer, ad->as);
417 }
---