]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
2012-09-07 Jakub Jelinek <jakub@redhat.com>
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Sep 2012 09:35:21 +0000 (09:35 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Sep 2012 09:35:21 +0000 (09:35 +0000)
Backported from mainline
2012-09-06  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/54455
* sel-sched-ir.c (maybe_tidy_empty_bb): Give up if previous fallthru
bb ends up with asm goto referencing bb's label.

* gcc.dg/54455.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@191060 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/sel-sched-ir.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/54455.c [new file with mode: 0644]

index 17993ae0d946e7b903da68e820ed3d7ed082cc9b..3424cdd4b9cd036a8c74ad96572c1640dd199e6e 100644 (file)
@@ -1,3 +1,12 @@
+2012-09-07  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2012-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/54455
+       * sel-sched-ir.c (maybe_tidy_empty_bb): Give up if previous fallthru
+       bb ends up with asm goto referencing bb's label.
+
 2012-09-07  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
 
        Backport from mainline.
index c53d2e1a8e9edf27c5e40dc690081d46d78bd477..e74fee248b56a3272808a22927d5cd0939334249 100644 (file)
@@ -1,5 +1,5 @@
 /* Instruction scheduling pass.  Selective scheduler and pipeliner.
-   Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
+   Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -3680,6 +3680,22 @@ maybe_tidy_empty_bb (basic_block bb)
   FOR_EACH_EDGE (e, ei, bb->preds)
     if (e->flags & EDGE_COMPLEX)
       return false;
+    else if (e->flags & EDGE_FALLTHRU)
+      {
+       rtx note;
+       /* If prev bb ends with asm goto, see if any of the
+          ASM_OPERANDS_LABELs don't point to the fallthru
+          label.  Do not attempt to redirect it in that case.  */
+       if (JUMP_P (BB_END (e->src))
+           && (note = extract_asm_operands (PATTERN (BB_END (e->src)))))
+         {
+           int i, n = ASM_OPERANDS_LABEL_LENGTH (note);
+
+           for (i = 0; i < n; ++i)
+             if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (bb))
+               return false;
+         }
+      }
 
   free_data_sets (bb);
 
index 6fc96b9bf1acc8ebb2662d64b26725c6e0791f94..09cf47a643a7e793b9a4790bf88fea0c9c2e5509 100644 (file)
@@ -1,3 +1,11 @@
+2012-09-07  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2012-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/54455
+       * gcc.dg/54455.c: New test.
+
 2012-09-06  Andrew Pinski  <apinski@cavium.com>
 
        PR tree-opt/54494
diff --git a/gcc/testsuite/gcc.dg/54455.c b/gcc/testsuite/gcc.dg/54455.c
new file mode 100644 (file)
index 0000000..de68a53
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/54455 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fschedule-insns -fselective-scheduling --param max-sched-extend-regions-iters=2" } */
+
+extern void fn1 (void), fn2 (void);
+
+static inline __attribute__((always_inline)) int
+foo (int *x, long y)
+{
+  asm goto ("" : : "r" (x), "r" (y) : "memory" : lab);
+  return 0;
+lab:
+  return 1;
+}
+
+void
+bar (int *x)
+{
+  if (foo (x, 23))
+    fn1 ();
+  else
+    fn2 ();
+
+  foo (x, 2);
+}