On 09/10/2026 13:06, Richard Sandiford wrote:
Andrew Stubbs <[email protected]> writes:
On 09/10/2026 12:15, Richard Sandiford wrote:
+ 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.
That does seem like a good idea.
Question: change_address uses MEM_COPY_ATTRIBUTES ... another thing I
wasn't aware of ... should I add the new MEM_INDEPENDENT_P flag to that
copy?
/* Copy the attributes that apply to memory locations from RHS to LHS. */
#define MEM_COPY_ATTRIBUTES(LHS, RHS) \
(MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \
MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \
MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \
MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \
MEM_POINTER (LHS) = MEM_POINTER (RHS), \
+ MEM_INDEPENDENT_P (LHS) = MEM_INDEPENDENT_P (RHS), \
MEM_ATTRS (LHS) = MEM_ATTRS (RHS))
That sounds ok. But it would mean that either (a) changes from vector
addresses to scalar addresses would need to explicitly clear the flag
or (b) scalar addresses would be allowed to have a nonzero
MEM_INDEPENDENT_P. (b) sounds less error-prone.
Given that nothing checks the flag anywhere, I think it should be safe.
Thank you for the review.
I will get these changes made, rebase and retest everything, and commit
sometime next week.
Andrew