]> gcc.gnu.org Git - gcc.git/commitdiff
LRA: Do not repeat inheritance and live range splitting in case of asm error
authorVladimir N. Makarov <vmakarov@redhat.com>
Wed, 22 Mar 2023 16:33:11 +0000 (12:33 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Wed, 22 Mar 2023 17:36:30 +0000 (13:36 -0400)
LRA was trying to do live range splitting again and again as there were
no enough regs for asm.  This patch solves the problem.

        PR target/109137

gcc/ChangeLog:

* lra.cc (lra): Do not repeat inheritance and live range splitting
when asm error is found.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr109137.c: New.

gcc/lra.cc
gcc/testsuite/gcc.target/i386/pr109137.c [new file with mode: 0644]

index f7fdd601e7166b04bc78cb6ffc6e5571f75202e2..eb3ee1f8b63a78f0b0b6a614236d1adaee84375d 100644 (file)
@@ -2453,7 +2453,7 @@ lra (FILE *f)
                  lra_hard_reg_split_p = true;
                }
            }
-         while (fails_p);
+         while (fails_p && !lra_asm_error_p);
          if (! live_p) {
            /* We need the correct reg notes for work of constraint sub-pass.  */
            lra_create_live_ranges (true, true);
diff --git a/gcc/testsuite/gcc.target/i386/pr109137.c b/gcc/testsuite/gcc.target/i386/pr109137.c
new file mode 100644 (file)
index 0000000..ffd8e8c
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-m32 -O3 -march=znver1 -fPIC -mfpmath=sse -w" } */
+#include <string.h>
+typedef struct {
+  char bytestream_end;
+} CABACContext;
+int get_cabac___trans_tmp_3, get_cabac_tmp, get_cabac_c,
+    decode_cabac_mb_intra4x4_pred_mode_mode, ff_h264_decode_mb_cabac_h_0,
+    ff_h264_decode_mb_cabac_bit;
+typedef struct {
+  char intra4x4_pred_mode_cache[2];
+} H264SliceContext;
+H264SliceContext ff_h264_decode_mb_cabac_sl;
+void ff_h264_decode_mb_cabac(void) {
+  memset((void*)ff_h264_decode_mb_cabac_h_0, 6, 48);
+  int i;
+  for (;; i++) {
+    __asm__(""/* { dg-error "'asm' operand has impossible constraints" } */
+            : "=&r"(ff_h264_decode_mb_cabac_bit), "=&r"(get_cabac_c),
+              "=&r"(get_cabac_c), "=&q"(get_cabac_tmp)
+            : "r"(get_cabac___trans_tmp_3),
+              "r"(__builtin_offsetof(CABACContext, bytestream_end))
+            : "ecx");
+    ff_h264_decode_mb_cabac_sl.intra4x4_pred_mode_cache[i] =
+        decode_cabac_mb_intra4x4_pred_mode_mode;
+  }
+}
+
This page took 0.083823 seconds and 5 git commands to generate.