]> git.ipfire.org Git - thirdparty/gcc.git/commit
Tweak base/index disambiguation in decompose_normal_address [PR116236]
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 15 Aug 2024 15:54:03 +0000 (16:54 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 15 Aug 2024 15:54:03 +0000 (16:54 +0100)
commit3673b7054ec268c445620b9c52d25e65bc9a7f96
treed6f48b271dc0fe409b31702e4c7f8f8882a8dfd4
parent70ae0daeb76f28a3135f4a74d6e440fb1d9821fa
Tweak base/index disambiguation in decompose_normal_address [PR116236]

The PR points out that, for an address like:

  (plus (zero_extend X) Y)

decompose_normal_address doesn't establish a strong preference
between treating X as the base or Y as the base.  As the comment
in the patch says, zero_extend isn't enough on its own to assume
an index, at least not on POINTERS_EXTEND_UNSIGNED targets.
But in a construct like the one above, X and Y have different modes,
and it seems reasonable to assume that the one with the expected
address mode is the base.

This matters on targets like m68k that support index extension
and that require different classes for bases and indices.

gcc/
PR middle-end/116236
* rtlanal.cc (decompose_normal_address): Try to distinguish
bases and indices based on mode, before resorting to "baseness".
gcc/rtlanal.cc