https://gcc.gnu.org/g:bddc41e290113dd9160b01f2fdf925a1876c8ee0

commit r16-2136-gbddc41e290113dd9160b01f2fdf925a1876c8ee0
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Wed Jul 9 14:59:34 2025 +0100

    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.

Diff:
---
 gcc/ext-dce.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc
index e7635fb7a394..67ec92a42878 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

Reply via email to