]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/61220 (ICE on valid code at -O2 on x86_64-linux-gnu in maybe_r...
authorZhenqiang Chen <zhenqiang.chen@linaro.org>
Mon, 26 May 2014 06:11:33 +0000 (06:11 +0000)
committerZhenqiang Chen <zqchen@gcc.gnu.org>
Mon, 26 May 2014 06:11:33 +0000 (06:11 +0000)
ChangeLog:
2014-05-26  Zhenqiang Chen  <zhenqiang.chen@linaro.org>

PR rtl-optimization/61220
Part of PR rtl-optimization/61225
* shrink-wrap.c (move_insn_for_shrink_wrap): Skip SP and FP adjustment
insn; skip split_edge for a block with only one successor.

testsuite/ChangeLog:
2014-05-26  Zhenqiang Chen  <zhenqiang.chen@linaro.org>

* gcc.dg/pr61220.c: New test.
* gcc.dg/shrink-wrap-loop.c: Disable for x86_64 -m32 mode.

From-SVN: r210921

gcc/ChangeLog
gcc/shrink-wrap.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr61220.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/shrink-wrap-loop.c

index c8b1a3f47557eee6cc85428eb59e29a3e1c1f19f..b878cb63db3960d10bf172656677748fc389ad53 100644 (file)
@@ -1,3 +1,11 @@
+ChangeLog:
+2014-05-26  Zhenqiang Chen  <zhenqiang.chen@linaro.org>
+
+       PR rtl-optimization/61220
+       Part of PR rtl-optimization/61225
+       * shrink-wrap.c (move_insn_for_shrink_wrap): Skip SP and FP adjustment
+       insn; skip split_edge for a block with only one successor.
+
 2014-05-23  Jan Hubicka  <hubicka@ucw.cz>
 
        * symtab.c (symtab_nonoverwritable_alias): Copy READONLY flag for variables.
index f09cfe7b1f9007452752785d53eb4131ecb882c7..68635025a33623fb6c054e786787ef8652105536 100644 (file)
@@ -179,7 +179,12 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn,
     return false;
   src = SET_SRC (set);
   dest = SET_DEST (set);
-  if (!REG_P (dest) || !REG_P (src))
+  if (!REG_P (dest) || !REG_P (src)
+      /* STACK or FRAME related adjustment might be part of prologue.
+        So keep them in the entry block.  */
+      || dest == stack_pointer_rtx
+      || dest == frame_pointer_rtx
+      || dest == hard_frame_pointer_rtx)
     return false;
 
   /* Make sure that the source register isn't defined later in BB.  */
@@ -204,6 +209,10 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn,
   /* Create a new basic block on the edge.  */
   if (EDGE_COUNT (next_block->preds) == 2)
     {
+      /* split_edge for a block with only one successor is meaningless.  */
+      if (EDGE_COUNT (bb->succs) == 1)
+       return false;
+
       next_block = split_edge (live_edge);
 
       bitmap_copy (df_get_live_in (next_block), df_get_live_out (bb));
index 49e4bb7826ca5ebbcbb2385efaf12fe63a839313..5157ad86f6a57b7172c64d4f72d5f6446ea1fcf7 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-26  Zhenqiang Chen  <zhenqiang.chen@linaro.org>
+
+       * gcc.dg/pr61220.c: New test.
+       * gcc.dg/shrink-wrap-loop.c: Disable for x86_64 -m32 mode.
+
 2014-05-25  Tobias Burnus  <burnus@net-b.de>
 
        * gfortran.dg/coarray_10.f90: Update dg-warning.
diff --git a/gcc/testsuite/gcc.dg/pr61220.c b/gcc/testsuite/gcc.dg/pr61220.c
new file mode 100644 (file)
index 0000000..d45d1c3
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+int a, c, d, e, f, g, h, i, j, k;
+
+struct S0
+{
+  int f0;
+  int f1;
+  int f2;
+};
+
+struct S1
+{
+  int f0;
+  int f1;
+  struct S0 f2;
+} b;
+
+void
+fn1 (struct S1 p)
+{
+  for (; k; k++)
+    h = j ? a : a - 1;
+  d &= i;
+}
+
+int
+main ()
+{
+  int l[5] = { 0 };
+  fn1 (b);
+  for (c = 0; c < 3; c++)
+    for (g = 0; g < 3; g++)
+      l[c * 2] = e = l[c];
+  if (f)
+    fn1 (b);
+  return 0;
+}
index 17dca4e5c3d6fac42dc496d477f6e4112c3c5f14..e72edfa6c4449293232ef8899beedb3c0179be6c 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { { x86_64-*-* } || { arm_thumb2 } } } } */
+/* { dg-do compile { target { { x86_64-*-* && lp64 } || { arm_thumb2 } } } } */
 /* { dg-options "-O2 -fdump-rtl-pro_and_epilogue"  } */
 
 int foo (int *p1, int *p2);