]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PR100066] Check paradoxical subreg when splitting hard reg live range
authorVladimir N. Makarov <vmakarov@redhat.com>
Wed, 14 Apr 2021 17:21:40 +0000 (13:21 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Wed, 14 Apr 2021 17:22:41 +0000 (13:22 -0400)
When splitting live range of a hard reg, LRA actually split multi-register
containing the hard reg.  So we need to check the biggest used mode of the hard reg on
paradoxical subregister when the natural and the biggest
mode are ordered.

gcc/ChangeLog:

PR rtl-optimization/100066
* lra-constraints.c (split_reg): Check paradoxical_subreg_p for
ordered modes when choosing splitting mode for hard reg.

gcc/testsuite/ChangeLog:

PR rtl-optimization/100066
* gcc.target/i386/pr100066.c: New.

gcc/lra-constraints.c
gcc/testsuite/gcc.target/i386/pr100066.c [new file with mode: 0644]

index 62bcfc317721806f1612c1b732bad4b238fde888..9425f2d7e73920c9543f28c19bf0e680ea742497 100644 (file)
@@ -5797,10 +5797,14 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn,
       mode = lra_reg_info[hard_regno].biggest_mode;
       machine_mode reg_rtx_mode = GET_MODE (regno_reg_rtx[hard_regno]);
       /* A reg can have a biggest_mode of VOIDmode if it was only ever seen as
-        part of a multi-word register.  In that case, just use the reg_rtx.
-        Otherwise, limit the size to that of the biggest access in the
-        function.  */
-      if (mode == VOIDmode)
+        part of a multi-word register.  In that case, just use the reg_rtx
+        mode.  Do the same also if the biggest mode was larger than a register
+        or we can not compare the modes.  Otherwise, limit the size to that of
+        the biggest access in the function.  */
+      if (mode == VOIDmode
+         || !ordered_p (GET_MODE_PRECISION (mode),
+                        GET_MODE_PRECISION (reg_rtx_mode))
+         || paradoxical_subreg_p (mode, reg_rtx_mode))
        {
          original_reg = regno_reg_rtx[hard_regno];
          mode = reg_rtx_mode;
diff --git a/gcc/testsuite/gcc.target/i386/pr100066.c b/gcc/testsuite/gcc.target/i386/pr100066.c
new file mode 100644 (file)
index 0000000..a795864
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { int128 } } } */
+/* { dg-options "-O1 -w" } */
+int pm;
+
+void
+w3 (int, int, int);
+
+void
+e6 (__int128 rt, long int mo)
+{
+  mo += rt / 0;
+  w3 (pm / mo, pm, 0);
+}