Am 07.02.25 um 22:28 schrieb Jeff Law:
On 2/7/25 11:01 AM, Georg-Johann Lay wrote:
Am 07.02.25 um 17:12 schrieb Jeff Law:
On 2/3/25 2:09 AM, Richard Sandiford wrote:
Jeff Law <jeffreya...@gmail.com> writes:
So pulling on this thread leads me into the code that sets up
ALLOCNO_WMODE in create_insn_allocnos:
if ((a = ira_curr_regno_allocno_map[regno]) == NULL)
{
a = ira_create_allocno (regno, false,
ira_curr_loop_tree_node);
if (outer != NULL && GET_CODE (outer) == SUBREG)
{
machine_mode wmode = GET_MODE (outer);
if (partial_subreg_p (ALLOCNO_WMODE (a), wmode))
ALLOCNO_WMODE (a) = wmode;
}
}
Note how we only set ALLOCNO_MODE only at allocno creation, so it'll
work as intended if and only if the first reference is via a SUBREG.
Huh, yeah, I agree that that looks wrong.
ISTM the fix here is to always do the check and set ALLOCNO_WMODE.
[ Snipped discussion on a non-issue. ]
So ISTM that moving the code out of the "if (... == NULL)" should be
enough on its own.
And it all makes sense that you caught this. You and another
colleague
at ARM were trying to address this exact problem ~11 years ago ;-)
Heh, thought it sounded familiar :)
So attached is the updated patch that adjusts IRA to avoid this problem.
Georg-Johann, this may explain an issue you were running into as well
where you got an invalid allocation. I think yours was at the higher
end of the register file, but the core issue is potentially the same
(looking at the first use rather than all of them for paradoxical
subregs).
You mean https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116389 ?
As far as I can tell that only occurred with reload but not with LRA.
Right. The change is in IRA so it would affect reload targets as well
as LRA targets.
jeff
That test case from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116389#c7
still ICEs with that change in http://gcc.gnu.org/r15-7428
pr116389-red.c: In function 'func':
pr116389-red.c:20:1: error: insn does not satisfy its constraints:
20 | }
| ^
(insn 27 69 28 5 (set (mem/c:SI (plus:HI (reg/f:HI 28 r28)
(const_int 2 [0x2])) [4 %sfp+2 S4 A8])
(reg:SI 30 r30)) "pr116389-red.c":16:19 146 {*movsi_split}
(nil))
during RTL pass: postreload
pr116389-red.c:20:1: internal compiler error: in extract_constrain_insn,
at recog.cc:2783
Reason is that R30 is the last GPR and can hold HImode at most,
but due to a paradoxical subreg, there is r30:SI.
Johann