recog.c (store_data_bypass_p_1): New function.
authorJakub Jelinek <jakub@redhat.com>
Mon, 11 Dec 2017 22:20:27 +0000 (23:20 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 11 Dec 2017 22:20:27 +0000 (23:20 +0100)
* recog.c (store_data_bypass_p_1): New function.
(store_data_bypass_p): Handle USE in a PARALLEL like CLOBBER.  Use
store_data_bypass_p_1 to avoid code duplication.  Formatting fixes.

From-SVN: r255553

gcc/ChangeLog
gcc/recog.c

index 8c9fe1bfcc23fac87c67f178c619d2d181ea6cc5..bd41af866365912a2f4ca828ec163426eada38ce 100644 (file)
@@ -1,3 +1,9 @@
+2017-12-11  Jakub Jelinek  <jakub@redhat.com>
+
+       * recog.c (store_data_bypass_p_1): New function.
+       (store_data_bypass_p): Handle USE in a PARALLEL like CLOBBER.  Use
+       store_data_bypass_p_1 to avoid code duplication.  Formatting fixes.
+
 2017-12-11  Segher Boessenkool  <segher@kernel.crashing.org>
 
        PR rtl-optimization/83361
index 4f11c579137cfbca9533a8b8159055ec5d9191e0..cdcff8f2e720c6415bd4ca6f4fe206e551ce13c0 100644 (file)
@@ -3657,93 +3657,65 @@ peephole2_optimize (void)
 
 /* Common predicates for use with define_bypass.  */
 
-/* True if the dependency between OUT_INSN and IN_INSN is on the store
-   data not the address operand(s) of the store.  IN_INSN and OUT_INSN
-   must be either a single_set or a PARALLEL with SETs inside.  */
+/* Helper function for store_data_bypass_p, handle just a single SET
+   IN_SET.  */
 
-int
-store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn)
+static bool
+store_data_bypass_p_1 (rtx_insn *out_insn, rtx in_set)
 {
-  rtx out_set, in_set;
-  rtx out_pat, in_pat;
-  rtx out_exp, in_exp;
-  int i, j;
+  if (!MEM_P (SET_DEST (in_set)))
+    return false;
 
-  in_set = single_set (in_insn);
-  if (in_set)
+  rtx out_set = single_set (out_insn);
+  if (out_set)
+    return !reg_mentioned_p (SET_DEST (out_set), SET_DEST (in_set));
+
+  rtx out_pat = PATTERN (out_insn);
+  if (GET_CODE (out_pat) != PARALLEL)
+    return false;
+
+  for (int i = 0; i < XVECLEN (out_pat, 0); i++)
     {
-      if (!MEM_P (SET_DEST (in_set)))
-       return false;
+      rtx out_exp = XVECEXP (out_pat, 0, i);
 
-      out_set = single_set (out_insn);
-      if (out_set)
-        {
-          if (reg_mentioned_p (SET_DEST (out_set), SET_DEST (in_set)))
-            return false;
-        }
-      else
-        {
-          out_pat = PATTERN (out_insn);
+      if (GET_CODE (out_exp) == CLOBBER || GET_CODE (out_exp) == USE)
+       continue;
 
-         if (GET_CODE (out_pat) != PARALLEL)
-           return false;
+      gcc_assert (GET_CODE (out_exp) == SET);
 
-          for (i = 0; i < XVECLEN (out_pat, 0); i++)
-          {
-            out_exp = XVECEXP (out_pat, 0, i);
+      if (reg_mentioned_p (SET_DEST (out_exp), SET_DEST (in_set)))
+       return false;
+    }
 
-            if (GET_CODE (out_exp) == CLOBBER)
-              continue;
+  return true;
+}
 
-            gcc_assert (GET_CODE (out_exp) == SET);
+/* True if the dependency between OUT_INSN and IN_INSN is on the store
+   data not the address operand(s) of the store.  IN_INSN and OUT_INSN
+   must be either a single_set or a PARALLEL with SETs inside.  */
 
-            if (reg_mentioned_p (SET_DEST (out_exp), SET_DEST (in_set)))
-              return false;
-          }
-      }
-    }
-  else
-    {
-      in_pat = PATTERN (in_insn);
-      gcc_assert (GET_CODE (in_pat) == PARALLEL);
+int
+store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn)
+{
+  rtx in_set = single_set (in_insn);
+  if (in_set)
+    return store_data_bypass_p_1 (out_insn, in_set);
 
-      for (i = 0; i < XVECLEN (in_pat, 0); i++)
-       {
-         in_exp = XVECEXP (in_pat, 0, i);
+  rtx in_pat = PATTERN (in_insn);
+  if (GET_CODE (in_pat) != PARALLEL)
+    return false;
 
-         if (GET_CODE (in_exp) == CLOBBER)
-           continue;
+  for (int i = 0; i < XVECLEN (in_pat, 0); i++)
+    {
+      rtx in_exp = XVECEXP (in_pat, 0, i);
 
-         gcc_assert (GET_CODE (in_exp) == SET);
+      if (GET_CODE (in_exp) == CLOBBER || GET_CODE (in_exp) == USE)
+       continue;
 
-         if (!MEM_P (SET_DEST (in_exp)))
-           return false;
+      gcc_assert (GET_CODE (in_exp) == SET);
 
-          out_set = single_set (out_insn);
-          if (out_set)
-            {
-              if (reg_mentioned_p (SET_DEST (out_set), SET_DEST (in_exp)))
-                return false;
-            }
-          else
-            {
-              out_pat = PATTERN (out_insn);
-              gcc_assert (GET_CODE (out_pat) == PARALLEL);
-
-              for (j = 0; j < XVECLEN (out_pat, 0); j++)
-                {
-                  out_exp = XVECEXP (out_pat, 0, j);
-
-                  if (GET_CODE (out_exp) == CLOBBER)
-                    continue;
-
-                  gcc_assert (GET_CODE (out_exp) == SET);
-
-                  if (reg_mentioned_p (SET_DEST (out_exp), SET_DEST (in_exp)))
-                    return false;
-                }
-            }
-        }
+      if (!store_data_bypass_p_1 (out_insn, in_exp))
+       return false;
     }
 
   return true;