This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch ping: Add static branch predict heuristic of comparing IV to loop_bound variable
Sorry for the error. Here is a new patch to fix them:
gcc/testsuite/ChangeLog:
2012-05-08 Dehao Chen <dehao@google.com>
* gcc.dg/predict-1.c: Remove the replicated text in this text.
* gcc.dg/predict-2.c: Likewise.
* gcc.dg/predict-3.c: Likewise.
* gcc.dg/predict-4.c: Likewise.
* gcc.dg/predict-5.c: Likewise.
* gcc.dg/predict-6.c: Likewise.
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog (revision 187307)
+++ gcc/ChangeLog (working copy)
@@ -110,15 +110,15 @@
2012-05-08 Dehao Chen <dehao@google.com>
- * predict.c (find_qualified_ssa_name): New
- (find_ssa_name_in_expr): New
- (find_ssa_name_in_assign_stmt): New
- (is_comparison_with_loop_invariant_p): New
- (is_bound_expr_similar): New
- (predict_iv_comparison): New
+ * predict.c (find_qualified_ssa_name): New.
+ (find_ssa_name_in_expr): New.
+ (find_ssa_name_in_assign_stmt): New.
+ (is_comparison_with_loop_invariant_p): New.
+ (is_bound_expr_similar): New.
+ (predict_iv_comparison): New.
(predict_loops): Add heuristic for loop-nested branches that compare an
induction variable to a loop bound variable.
- * predict.def (PRED_LOOP_IV_COMPARE): New macro
+ * predict.def (PRED_LOOP_IV_COMPARE): New macro.
2012-05-08 Uros Bizjak <ubizjak@gmail.com>
Index: gcc/testsuite/gcc.dg/predict-3.c
===================================================================
--- gcc/testsuite/gcc.dg/predict-3.c (revision 187307)
+++ gcc/testsuite/gcc.dg/predict-3.c (working copy)
@@ -23,28 +23,3 @@
/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
100.0%" 4 "profile_estimate"} } */
/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
-
-extern int global;
-
-int bar(int);
-
-void foo (int bound)
-{
- 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 { cleanup-tree-dump "profile_estimate" } } */
Index: gcc/testsuite/gcc.dg/predict-4.c
===================================================================
--- gcc/testsuite/gcc.dg/predict-4.c (revision 187307)
+++ gcc/testsuite/gcc.dg/predict-4.c (working copy)
@@ -17,22 +17,3 @@
/* { dg-final { scan-tree-dump "loop iv compare heuristics: 50.0%"
"profile_estimate"} } */
/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
-
-extern int global;
-
-int bar(int);
-
-void foo (int bound)
-{
- int i, ret = 0;
- for (i = 0; i < 10; i++)
- {
- if (i < 5)
- global += bar (i);
- }
-}
-
-/* { dg-final { scan-tree-dump "loop iv compare heuristics: 50.0%"
"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 187307)
+++ gcc/testsuite/gcc.dg/predict-1.c (working copy)
@@ -25,30 +25,3 @@
/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
0.0%" 5 "profile_estimate"} } */
/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-profile_estimate" } */
-
-extern int global;
-
-int bar(int);
-
-void foo (int bound)
-{
- 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 { cleanup-tree-dump "profile_estimate" } } */
Index: gcc/testsuite/gcc.dg/predict-5.c
===================================================================
--- gcc/testsuite/gcc.dg/predict-5.c (revision 187307)
+++ gcc/testsuite/gcc.dg/predict-5.c (working copy)
@@ -23,28 +23,3 @@
/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
100.0%" 4 "profile_estimate"} } */
/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
-/* { 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 187307)
+++ gcc/testsuite/gcc.dg/predict-2.c (working copy)
@@ -25,30 +25,3 @@
/* { dg-final { scan-tree-dump-not "loop iv compare heuristics"
"profile_estimate"} } */
/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
-/* { 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 > 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)
- global += bar (i);
- }
-}
-
-/* { dg-final { scan-tree-dump-not "loop iv compare heuristics"
"profile_estimate"} } */
-/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
Index: gcc/testsuite/gcc.dg/predict-6.c
===================================================================
--- gcc/testsuite/gcc.dg/predict-6.c (revision 187307)
+++ gcc/testsuite/gcc.dg/predict-6.c (working copy)
@@ -23,28 +23,3 @@
/* { dg-final { scan-tree-dump-times "loop iv compare heuristics:
0.0%" 4 "profile_estimate"} } */
/* { dg-final { cleanup-tree-dump "profile_estimate" } } */
-/* { 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" } } */