On 09/10/2026 12:15, Richard Sandiford wrote:
Sorry, a couple of other things:
+
+ rtx new_addr
+ = (REG_P (addr)
+ ? simplify_gen_subreg (addr_elt_mode, addr, addrmode,
+ addr_byte)
+ : simplify_subreg (addr_elt_mode, addr, addrmode, addr_byte));
I think we should use simplify_gen_subreg unconditionally unless there's
a specific reason not to. This is a simplification regardless of what
the address is.
I tried this and got an ICE. AFAICT, simplify_gen_subreg does the wrong
thing (in this situation) when the address has an offset:
(mem/i:V8QI (plus:V8DI (reg:V8DI 720)
(vec_duplicate:V8DI (const_int 0))))
It tries to wrap the plus in a subreg, which is not valid. So, I'm going
to leave this bit as-is, unless you have a better suggestion?
+ if (new_addr)
+ {
+ rtx new_mem = gen_rtx_MEM (outermode, new_addr);
+ set_mem_addr_space (new_mem, MEM_ADDR_SPACE (op));
+ MEM_VOLATILE_P (new_mem) = MEM_VOLATILE_P (op);
+ MEM_NOTRAP_P (new_mem) = MEM_NOTRAP_P (op);
+ return new_mem;
I think this should use change_address instead. AIUI, that is suitable
for any change that preserves the alias set.
This part is fine, and probably better, indeed.
Andrew