]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cprop_hardreg: Enable propagation of the stack pointer if possible
authorManolis Tsamis <manolis.tsamis@vrull.eu>
Thu, 25 May 2023 11:44:41 +0000 (13:44 +0200)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Thu, 15 Jun 2023 20:13:36 +0000 (22:13 +0200)
Propagation of the stack pointer in cprop_hardreg is currenty
forbidden in all cases, due to maybe_mode_change returning NULL.
Relax this restriction and allow propagation when no mode change is
requested.

gcc/ChangeLog:

* regcprop.cc (maybe_mode_change): Enable stack pointer
propagation.

gcc/regcprop.cc

index f426f4fedcd538c9460a99428548d6427c6313ce..6cbfadb181f8378f065cd2787e9f2cfa84a0068b 100644 (file)
@@ -422,7 +422,12 @@ maybe_mode_change (machine_mode orig_mode, machine_mode copy_mode,
 
      It's unclear if we need to do the same for other special registers.  */
   if (regno == STACK_POINTER_REGNUM)
-    return NULL_RTX;
+    {
+      if (orig_mode == new_mode)
+       return stack_pointer_rtx;
+      else
+       return NULL_RTX;
+    }
 
   if (orig_mode == new_mode)
     return gen_raw_REG (new_mode, regno);