Skip to contentSkip to conversation

or1k: Fix ICE in libgcc caused by recent validate_subreg changes

PATCH In review Stafford Horne 2 participants 3 messages Jun 9, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 or1k: Fix ICE in libgcc caused by recent validate_subreg changes

After commit eb2ea476db2 ("emit-rtl: Allow extra checks for paradoxical subregs [PR119966]") paradoxical subregs or the OpenRISC condition flag register (reg:BI sr_f) are no longer allowed.

This causes and ICE in the ce1 pass which tries to get the or1k flag register into an SI register, which is no longer possible.

Adjust or1k_can_change_mode_class to allow changing the or1k flag reg to SI mode which in turn allows paradoxical subregs to bre generated again.

gcc/ChangeLog:

PR or1k/120587
* config/or1k/or1k.cc (or1k_can_change_mode_class): Allow changing flags mode from BI to SI to allow for paradoxical subregs.

---
 gcc/config/or1k/or1k.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
gcc/config/or1k/or1k.cc +2 -1
index 62e2168e0ee..f1c92c6bf6c 100644
@@ -1408,8 +1408,9 @@ static bool
 or1k_can_change_mode_class (machine_mode from, machine_mode to,
 			    reg_class_t rclass)
 {
+  /* Allow cnoverting special flags to SI mode subregs.  */
   if (rclass == FLAG_REGS)
-    return from == to;
+    return from == to || (from == BImode && to == SImode);
   return true;
 }
 
Signature · 1 line
2.49.0
#1 lore raw
Quoted 10 lines · Stafford Horne

After commit eb2ea476db2 ("emit-rtl: Allow extra checks for paradoxical subregs [PR119966]") paradoxical subregs or the OpenRISC condition flag register (reg:BI sr_f) are no longer allowed.

This causes and ICE in the ce1 pass which tries to get the or1k flag register into an SI register, which is no longer possible.

Adjust or1k_can_change_mode_class to allow changing the or1k flag reg to SI mode which in turn allows paradoxical subregs to bre generated again.

Quoted 6 lines

gcc/ChangeLog:

PR or1k/120587
* config/or1k/or1k.cc (or1k_can_change_mode_class): Allow changing flags mode from BI to SI to allow for paradoxical subregs.

Wrong mailing list I think (gcc, not gdb).

Simon

#2 lore raw
Quoted 11 lines · Simon Marchi
Quoted 10 lines · Stafford Horne

After commit eb2ea476db2 ("emit-rtl: Allow extra checks for paradoxical subregs [PR119966]") paradoxical subregs or the OpenRISC condition flag register (reg:BI sr_f) are no longer allowed.

This causes and ICE in the ce1 pass which tries to get the or1k flag register into an SI register, which is no longer possible.

Adjust or1k_can_change_mode_class to allow changing the or1k flag reg to SI mode which in turn allows paradoxical subregs to bre generated again.

Quoted 8 lines
Quoted 6 lines

gcc/ChangeLog:

PR or1k/120587
* config/or1k/or1k.cc (or1k_can_change_mode_class): Allow changing flags mode from BI to SI to allow for paradoxical subregs.

Wrong mailing list I think (gcc, not gdb).

Yes sorry, I have tab completion and gdb-patches looked like gcc-patches to me.

I have resent to the correct list.

-Stafford