Re: [google] revert r185948

2012-04-03 Thread Rong Xu
OK for google-4_6 branch.

-Rong

On Tue, Apr 3, 2012 at 5:30 PM, Dehao Chen  wrote:
>
> Revert r185948, which causes regression to major applications.
>
> Bootstrapped.
>
> OK for google-4_6?
>
> Thanks,
> Dehao
>
> Index: gcc/testsuite/gcc.dg/predict-3.c
> ===
> --- gcc/testsuite/gcc.dg/predict-3.c    (revision 186128)
> +++ gcc/testsuite/gcc.dg/predict-3.c    (working copy)
> @@ -10,16 +10,10 @@
>   int i, ret = 0;
>   for (i = 0; i <= bound; i++)
>     {
> -      if (i < bound - 2)
> -       global += bar (i);
> -      if (i <= bound)
> -       global += bar (i);
> -      if (i + 1 < bound)
> -       global += bar (i);
>       if (i != bound)
>        global += bar (i);
>     }
>  }
>
> -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
> 100.0%" 4 "profile_estimate"} } */
> +/* { dg-final { scan-tree-dump "loop iv compare heuristics"
> "profile_estimate"} } */
>  /* { dg-final { cleanup-tree-dump "profile_estimate" } } */
> Index: gcc/testsuite/gcc.dg/predict-4.c
> ===
> --- gcc/testsuite/gcc.dg/predict-4.c    (revision 186128)
> +++ gcc/testsuite/gcc.dg/predict-4.c    (working copy)
> @@ -15,5 +15,5 @@
>     }
>  }
>
> -/* { dg-final { scan-tree-dump "loop iv compare heuristics: 50.0%"
> "profile_estimate"} } */
> +/* { dg-final { scan-tree-dump "loop iv compare heuristics"
> "profile_estimate"} } */
>  /* { dg-final { cleanup-tree-dump "profile_estimate" } } */
> Index: gcc/testsuite/gcc.dg/predict-1.c
> ===
> --- gcc/testsuite/gcc.dg/predict-1.c    (revision 186128)
> +++ gcc/testsuite/gcc.dg/predict-1.c    (working copy)
> @@ -10,18 +10,10 @@
>   int i, ret = 0;
>   for (i = 0; i < bound; i++)
>     {
> -      if (i > bound)
> -       global += bar (i);
> -      if (i >= bound + 2)
> -       global += bar (i);
>       if (i > bound - 2)
>        global += bar (i);
> -      if (i + 2 > bound)
> -       global += bar (i);
> -      if (i == 10)
> -       global += bar (i);
>     }
>  }
>
> -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
> 0.0%" 5 "profile_estimate"} } */
> +/* { dg-final { scan-tree-dump "loop iv compare heuristics"
> "profile_estimate"} } */
>  /* { dg-final { cleanup-tree-dump "profile_estimate" } } */
> Index: gcc/testsuite/gcc.dg/predict-5.c
> ===
> --- gcc/testsuite/gcc.dg/predict-5.c    (revision 186128)
> +++ gcc/testsuite/gcc.dg/predict-5.c    (working copy)
> @@ -1,25 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
> -
> -extern int global;
> -
> -int bar (int);
> -
> -void foo (int base, int bound)
> -{
> -  int i, ret = 0;
> -  for (i = base; i <= bound; i++)
> -    {
> -      if (i > base)
> -       global += bar (i);
> -      if (i > base + 1)
> -       global += bar (i);
> -      if (i >= base + 3)
> -       global += bar (i);
> -      if (i - 2 >= base)
> -       global += bar (i);
> -    }
> -}
> -
> -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
> 100.0%" 4 "profile_estimate"} } */
> -/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
> Index: gcc/testsuite/gcc.dg/predict-2.c
> ===
> --- gcc/testsuite/gcc.dg/predict-2.c    (revision 186128)
> +++ gcc/testsuite/gcc.dg/predict-2.c    (working copy)
> @@ -5,20 +5,12 @@
>
>  int bar(int);
>
> -void foo (int base, int bound)
> +void foo (int bound)
>  {
>   int i, ret = 0;
> -  for (i = base; i < bound; i++)
> +  for (i = 0; i < bound; i++)
>     {
> -      if (i > bound * bound)
> -       global += bar (i);
> -      if (i > bound + 10)
> -       global += bar (i);
> -      if (i <= bound + 10)
> -       global += bar (i);
> -      if (i > base + 10)
> -       global += bar (i);
> -      if (i < base - 10)
> +      if (i > bound * bound )
>        global += bar (i);
>     }
>  }
> Index: gcc/testsuite/gcc.dg/predict-6.c
> ===
> --- gcc/testsuite/gcc.dg/predict-6.c    (revision 186128)
> +++ gcc/testsuite/gcc.dg/predict-6.c    (working copy)
> @@ -1,25 +0,0 @@
> -/* { dg-do compile } */
> -/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
> -
> -extern int global;
> -
> -int bar (int);
> -
> -void foo (int base, int bound)
> -{
> -  int i, ret = 0;
> -  for (i = base; i <= bound; i++)
> -    {
> -      if (i < base)
> -       global += bar (i);
> -      if (i < base + 1)
> -       global += bar (i);
> -      if (i <= base + 3)
> -       global += bar (i);
> -      if (i - 1 < base)
> -       global += bar (i);
> -    }
> -}
> -
> -/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
> 0.0%" 4 "profile_estimate"} } */
> -/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
> Index: gcc/predict.c
> 

[google] revert r185948

2012-04-03 Thread Dehao Chen
Revert r185948, which causes regression to major applications.

Bootstrapped.

OK for google-4_6?

Thanks,
Dehao

Index: gcc/testsuite/gcc.dg/predict-3.c
===
--- gcc/testsuite/gcc.dg/predict-3.c(revision 186128)
+++ gcc/testsuite/gcc.dg/predict-3.c(working copy)
@@ -10,16 +10,10 @@
   int i, ret = 0;
   for (i = 0; i <= bound; i++)
 {
-  if (i < bound - 2)
-   global += bar (i);
-  if (i <= bound)
-   global += bar (i);
-  if (i + 1 < bound)
-   global += bar (i);
   if (i != bound)
global += bar (i);
 }
 }

-/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
100.0%" 4 "profile_estimate"} } */
+/* { dg-final { scan-tree-dump "loop iv compare heuristics"
"profile_estimate"} } */
 /* { dg-final { cleanup-tree-dump "profile_estimate" } } */
Index: gcc/testsuite/gcc.dg/predict-4.c
===
--- gcc/testsuite/gcc.dg/predict-4.c(revision 186128)
+++ gcc/testsuite/gcc.dg/predict-4.c(working copy)
@@ -15,5 +15,5 @@
 }
 }

-/* { dg-final { scan-tree-dump "loop iv compare heuristics: 50.0%"
"profile_estimate"} } */
+/* { dg-final { scan-tree-dump "loop iv compare heuristics"
"profile_estimate"} } */
 /* { dg-final { cleanup-tree-dump "profile_estimate" } } */
Index: gcc/testsuite/gcc.dg/predict-1.c
===
--- gcc/testsuite/gcc.dg/predict-1.c(revision 186128)
+++ gcc/testsuite/gcc.dg/predict-1.c(working copy)
@@ -10,18 +10,10 @@
   int i, ret = 0;
   for (i = 0; i < bound; i++)
 {
-  if (i > bound)
-   global += bar (i);
-  if (i >= bound + 2)
-   global += bar (i);
   if (i > bound - 2)
global += bar (i);
-  if (i + 2 > bound)
-   global += bar (i);
-  if (i == 10)
-   global += bar (i);
 }
 }

-/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
0.0%" 5 "profile_estimate"} } */
+/* { dg-final { scan-tree-dump "loop iv compare heuristics"
"profile_estimate"} } */
 /* { dg-final { cleanup-tree-dump "profile_estimate" } } */
Index: gcc/testsuite/gcc.dg/predict-5.c
===
--- gcc/testsuite/gcc.dg/predict-5.c(revision 186128)
+++ gcc/testsuite/gcc.dg/predict-5.c(working copy)
@@ -1,25 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
-
-extern int global;
-
-int bar (int);
-
-void foo (int base, int bound)
-{
-  int i, ret = 0;
-  for (i = base; i <= bound; i++)
-{
-  if (i > base)
-   global += bar (i);
-  if (i > base + 1)
-   global += bar (i);
-  if (i >= base + 3)
-   global += bar (i);
-  if (i - 2 >= base)
-   global += bar (i);
-}
-}
-
-/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
100.0%" 4 "profile_estimate"} } */
-/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
Index: gcc/testsuite/gcc.dg/predict-2.c
===
--- gcc/testsuite/gcc.dg/predict-2.c(revision 186128)
+++ gcc/testsuite/gcc.dg/predict-2.c(working copy)
@@ -5,20 +5,12 @@

 int bar(int);

-void foo (int base, int bound)
+void foo (int bound)
 {
   int i, ret = 0;
-  for (i = base; i < bound; i++)
+  for (i = 0; i < bound; i++)
 {
-  if (i > bound * bound)
-   global += bar (i);
-  if (i > bound + 10)
-   global += bar (i);
-  if (i <= bound + 10)
-   global += bar (i);
-  if (i > base + 10)
-   global += bar (i);
-  if (i < base - 10)
+  if (i > bound * bound )
global += bar (i);
 }
 }
Index: gcc/testsuite/gcc.dg/predict-6.c
===
--- gcc/testsuite/gcc.dg/predict-6.c(revision 186128)
+++ gcc/testsuite/gcc.dg/predict-6.c(working copy)
@@ -1,25 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
-
-extern int global;
-
-int bar (int);
-
-void foo (int base, int bound)
-{
-  int i, ret = 0;
-  for (i = base; i <= bound; i++)
-{
-  if (i < base)
-   global += bar (i);
-  if (i < base + 1)
-   global += bar (i);
-  if (i <= base + 3)
-   global += bar (i);
-  if (i - 1 < base)
-   global += bar (i);
-}
-}
-
-/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
0.0%" 4 "profile_estimate"} } */
-/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
Index: gcc/predict.c
===
--- gcc/predict.c   (revision 186128)
+++ gcc/predict.c   (working copy)
@@ -1070,10 +1070,6 @@
 bound = get_base_value (bound);
   if (!bound)
 return false;
-  if (TREE_CODE (base) != INTEGER_CST)
-base = get_base_value (base);
-  if (!base)
-return false;

   *loop_invariant = bound;
   *compare_code = code;