Skip to content

Commit dcba59a

Browse files
ptomsichKonstantinos Eleftheriou
andcommitted
ext-dce: fix off-by-one in subreg liveness for 32-bit modes
ext_dce_process_uses uses `size >= 32` to decide whether group 3 (bits 32-63) is live for a lowpart subreg source. For SImode subregs (size == 32), this incorrectly marks bits 32-63 as live, preventing the pass from recognizing that the upper half of a DImode register is dead. This blocks lw -> lwu narrowing on RV64. Change the condition to `size > 32`, consistent with the other thresholds in the same block (size > 8, size > 16). The size > 32 case is still reachable via SUBREG_PROMOTED_VAR_P which widens size beyond the outer mode. gcc/ChangeLog: * ext-dce.cc (ext_dce_process_uses): Fix off-by-one: use size > 32 instead of size >= 32 for group 3 liveness. Co-authored-by: Konstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu>
1 parent e6c1179 commit dcba59a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

gcc/ext-dce.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ ext_dce_process_uses (rtx_insn *insn, rtx obj,
13531353
bitmap_set_bit (livenow, rn + 1);
13541354
if (size > 16)
13551355
bitmap_set_bit (livenow, rn + 2);
1356-
if (size >= 32)
1356+
if (size > 32)
13571357
bitmap_set_bit (livenow, rn + 3);
13581358
iter.skip_subrtxes ();
13591359
}

0 commit comments

Comments
 (0)