]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ext-dce: Fix subreg_lsb is_constant assumption (2)
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 21 Jul 2025 14:41:01 +0000 (15:41 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Mon, 21 Jul 2025 14:41:01 +0000 (15:41 +0100)
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)

gcc/ext-dce.cc

index e7635fb7a394a7bc2a0f0f9b1b13c504da579fd6..67ec92a42878ac1ef1e133cd57a163f1ad4a3159 100644 (file)
@@ -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