https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116236
--- Comment #23 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>: https://gcc.gnu.org/g:3673b7054ec268c445620b9c52d25e65bc9a7f96 commit r15-2937-g3673b7054ec268c445620b9c52d25e65bc9a7f96 Author: Richard Sandiford <richard.sandif...@arm.com> Date: Thu Aug 15 16:54:03 2024 +0100 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".