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

--- Comment #15 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
As we create_mem_ref within ivopts, create_mem_ref_raw requires a
valid_mem_ref_p, which in memory_address_addr_space_p calls
targetm.addr_space.legitimate_address_p, and that's
avr_addr_space_legitimate_address_p, that calls avr_legitimate_address_p, that
rejects negative offsets to a REG.  That's where avr loses, compared with x86
and arm.

Because of this rejected address offset, we end up creating _16 = str_11 +
65535.  That eventually gets simplified to _16 = str_6 (in forwprop, no less),
but the str_11 = str_6 + 1 stmt remains because of the use in the phi node, and
it appears before the MEM_REF.

Now, the reason we validate the address is that create_mem_ref calls
create_mem_ref_raw with verify enabled.  Even though the letter might end up
creating a machine-independent MEM_REF, we end up constraining it according to
machine-dependent addressing limitations anyway.

Reply via email to