re PR middle-end/63743 (Thumb1: big regression for float operators by r216728)
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Mon, 9 Mar 2015 01:31:42 +0000 (01:31 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Mon, 9 Mar 2015 01:31:42 +0000 (01:31 +0000)
2015-03-09  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    PR tree-optimization/63743
    * cfgexpand.c (reorder_operands): Also reorder if only second operand
    had its definition forwarded by TER.

    gcc/testsuite/
    PR tree-optimization/63743
    * gcc.dg/pr63743.c: New test.

From-SVN: r221276

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr63743.c [new file with mode: 0644]

index 4c97e87b95079a5ad3534aa6005c4339570c92c2..07430ae567a1ef5e90eb25909a04f451a2661889 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-09  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR tree-optimization/63743
+       * cfgexpand.c (reorder_operands): Also reorder if only second operand
+       had its definition forwarded by TER.
+
 2015-03-08  Jan Hubicka  <hubicka@ucw.cz>
 
        PR lto/65316
index 569cd0d2390786b5486d486cdb9410aaf6110c9e..93d894f37419399c9d4670779f9d58ad810ba6bf 100644 (file)
@@ -5124,13 +5124,11 @@ reorder_operands (basic_block bb)
        continue;
       /* Swap operands if the second one is more expensive.  */
       def0 = get_gimple_for_ssa_name (op0);
-      if (!def0)
-       continue;
       def1 = get_gimple_for_ssa_name (op1);
       if (!def1)
        continue;
       swap = false;
-      if (lattice[gimple_uid (def1)] > lattice[gimple_uid (def0)])
+      if (!def0 || lattice[gimple_uid (def1)] > lattice[gimple_uid (def0)])
        swap = true;
       if (swap)
        {
@@ -5139,7 +5137,7 @@ reorder_operands (basic_block bb)
              fprintf (dump_file, "Swap operands in stmt:\n");
              print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
              fprintf (dump_file, "Cost left opnd=%d, right opnd=%d\n",
-                      lattice[gimple_uid (def0)],
+                      def0 ? lattice[gimple_uid (def0)] : 0,
                       lattice[gimple_uid (def1)]);
            }
          swap_ssa_operands (stmt, gimple_assign_rhs1_ptr (stmt),
index 50fc5d64d9e1eda245b9198daafc66fe016f03cd..8256fc3d9a6b499527f337e0091d7b612b01c4f1 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-09  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR tree-optimization/63743
+       * gcc.dg/pr63743.c: New test.
+
 2015-03-08  Jan Hubicka  <hubicka@ucw.cz>
 
        PR lto/65316
diff --git a/gcc/testsuite/gcc.dg/pr63743.c b/gcc/testsuite/gcc.dg/pr63743.c
new file mode 100644 (file)
index 0000000..87254ed
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-rtl-expand-details" } */
+
+double
+libcall_dep (double x, double y)
+{
+  return x * (x + y);
+}
+
+/* { dg-final { scan-rtl-dump-times "Swap operands" 1 "expand" } } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */