From: Richard Sandiford Date: Mon, 21 Jul 2025 14:41:01 +0000 (+0100) Subject: ext-dce: Fix subreg_lsb is_constant assumption (2) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b6038c17cabdbc8b9bfd0d13e2dd6f74db78734;p=thirdparty%2Fgcc.git ext-dce: Fix subreg_lsb is_constant assumption (2) This patch fixes another instance of the problem described in the cover note for g:bf3037e923e9f91d93ab64bdf73a37f64f659fb9. gcc/ * ext-dce.cc (ext_dce_process_uses): Apply is_constant directly to the subreg_lsb. (cherry picked from commit bddc41e290113dd9160b01f2fdf925a1876c8ee0) --- diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc index e7635fb7a39..67ec92a4287 100644 --- a/gcc/ext-dce.cc +++ b/gcc/ext-dce.cc @@ -757,7 +757,7 @@ ext_dce_process_uses (rtx_insn *insn, rtx obj, and process the inner object. */ if (paradoxical_subreg_p (y)) y = XEXP (y, 0); - else if (SUBREG_P (y) && SUBREG_BYTE (y).is_constant ()) + else if (SUBREG_P (y) && subreg_lsb (y).is_constant (&bit)) { /* If !TRULY_NOOP_TRUNCATION_MODES_P, the mode change performed by Y would normally need to be a @@ -774,8 +774,6 @@ ext_dce_process_uses (rtx_insn *insn, rtx obj, GET_MODE (SUBREG_REG (y)))))) break; - bit = subreg_lsb (y).to_constant (); - /* If this is a wide object (more bits than we can fit in a HOST_WIDE_INT), then just break from the SET context. That will cause the iterator to walk down