mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-30 06:36:34 +00:00
toolchain/gcc: fix PR 32044 patch
Somehow the patch was a patch adding a patch instead of the patch itself.
This commit is contained in:
parent
503ab93cfe
commit
6d48463df6
@ -1,193 +1,188 @@
|
|||||||
Index: toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch
|
Index: gcc-4.3.2/gcc/tree-scalar-evolution.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch (revision 0)
|
--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.c 2009-01-28 10:14:37.000000000 +0100
|
||||||
+++ toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch (revision 0)
|
+++ gcc-4.3.2/gcc/tree-scalar-evolution.c 2009-01-28 10:17:50.000000000 +0100
|
||||||
@@ -0,0 +1,188 @@
|
@@ -2716,6 +2716,50 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-scalar-evolution.c
|
scalar_evolution_info = NULL;
|
||||||
+===================================================================
|
}
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.c 2009-01-28 10:14:37.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/tree-scalar-evolution.c 2009-01-28 10:17:50.000000000 +0100
|
+/* Returns true if the expression EXPR is considered to be too expensive
|
||||||
+@@ -2716,6 +2716,50 @@
|
+ for scev_const_prop. */
|
||||||
+ scalar_evolution_info = NULL;
|
+
|
||||||
+ }
|
+bool
|
||||||
+
|
+expression_expensive_p (tree expr)
|
||||||
++/* Returns true if the expression EXPR is considered to be too expensive
|
+{
|
||||||
++ for scev_const_prop. */
|
+ enum tree_code code;
|
||||||
++
|
+
|
||||||
++bool
|
+ if (is_gimple_val (expr))
|
||||||
++expression_expensive_p (tree expr)
|
+ return false;
|
||||||
++{
|
+
|
||||||
++ enum tree_code code;
|
+ code = TREE_CODE (expr);
|
||||||
++
|
+ if (code == TRUNC_DIV_EXPR
|
||||||
++ if (is_gimple_val (expr))
|
+ || code == CEIL_DIV_EXPR
|
||||||
++ return false;
|
+ || code == FLOOR_DIV_EXPR
|
||||||
++
|
+ || code == ROUND_DIV_EXPR
|
||||||
++ code = TREE_CODE (expr);
|
+ || code == TRUNC_MOD_EXPR
|
||||||
++ if (code == TRUNC_DIV_EXPR
|
+ || code == CEIL_MOD_EXPR
|
||||||
++ || code == CEIL_DIV_EXPR
|
+ || code == FLOOR_MOD_EXPR
|
||||||
++ || code == FLOOR_DIV_EXPR
|
+ || code == ROUND_MOD_EXPR
|
||||||
++ || code == ROUND_DIV_EXPR
|
+ || code == EXACT_DIV_EXPR)
|
||||||
++ || code == TRUNC_MOD_EXPR
|
+ {
|
||||||
++ || code == CEIL_MOD_EXPR
|
+ /* Division by power of two is usually cheap, so we allow it.
|
||||||
++ || code == FLOOR_MOD_EXPR
|
+ Forbid anything else. */
|
||||||
++ || code == ROUND_MOD_EXPR
|
+ if (!integer_pow2p (TREE_OPERAND (expr, 1)))
|
||||||
++ || code == EXACT_DIV_EXPR)
|
+ return true;
|
||||||
++ {
|
+ }
|
||||||
++ /* Division by power of two is usually cheap, so we allow it.
|
+
|
||||||
++ Forbid anything else. */
|
+ switch (TREE_CODE_CLASS (code))
|
||||||
++ if (!integer_pow2p (TREE_OPERAND (expr, 1)))
|
+ {
|
||||||
++ return true;
|
+ case tcc_binary:
|
||||||
++ }
|
+ case tcc_comparison:
|
||||||
++
|
+ if (expression_expensive_p (TREE_OPERAND (expr, 1)))
|
||||||
++ switch (TREE_CODE_CLASS (code))
|
+ return true;
|
||||||
++ {
|
+
|
||||||
++ case tcc_binary:
|
+ /* Fallthru. */
|
||||||
++ case tcc_comparison:
|
+ case tcc_unary:
|
||||||
++ if (expression_expensive_p (TREE_OPERAND (expr, 1)))
|
+ return expression_expensive_p (TREE_OPERAND (expr, 0));
|
||||||
++ return true;
|
+
|
||||||
++
|
+ default:
|
||||||
++ /* Fallthru. */
|
+ return true;
|
||||||
++ case tcc_unary:
|
+ }
|
||||||
++ return expression_expensive_p (TREE_OPERAND (expr, 0));
|
+}
|
||||||
++
|
+
|
||||||
++ default:
|
/* Replace ssa names for that scev can prove they are constant by the
|
||||||
++ return true;
|
appropriate constants. Also perform final value replacement in loops,
|
||||||
++ }
|
in case the replacement expressions are cheap.
|
||||||
++}
|
@@ -2802,12 +2846,6 @@
|
||||||
++
|
continue;
|
||||||
+ /* Replace ssa names for that scev can prove they are constant by the
|
|
||||||
+ appropriate constants. Also perform final value replacement in loops,
|
niter = number_of_latch_executions (loop);
|
||||||
+ in case the replacement expressions are cheap.
|
- /* We used to check here whether the computation of NITER is expensive,
|
||||||
+@@ -2802,12 +2846,6 @@
|
- and avoided final value elimination if that is the case. The problem
|
||||||
+ continue;
|
- is that it is hard to evaluate whether the expression is too
|
||||||
+
|
- expensive, as we do not know what optimization opportunities the
|
||||||
+ niter = number_of_latch_executions (loop);
|
- the elimination of the final value may reveal. Therefore, we now
|
||||||
+- /* We used to check here whether the computation of NITER is expensive,
|
- eliminate the final values of induction variables unconditionally. */
|
||||||
+- and avoided final value elimination if that is the case. The problem
|
if (niter == chrec_dont_know)
|
||||||
+- is that it is hard to evaluate whether the expression is too
|
continue;
|
||||||
+- expensive, as we do not know what optimization opportunities the
|
|
||||||
+- the elimination of the final value may reveal. Therefore, we now
|
@@ -2838,7 +2876,15 @@
|
||||||
+- eliminate the final values of induction variables unconditionally. */
|
/* Moving the computation from the loop may prolong life range
|
||||||
+ if (niter == chrec_dont_know)
|
of some ssa names, which may cause problems if they appear
|
||||||
+ continue;
|
on abnormal edges. */
|
||||||
+
|
- || contains_abnormal_ssa_name_p (def))
|
||||||
+@@ -2838,7 +2876,15 @@
|
+ || contains_abnormal_ssa_name_p (def)
|
||||||
+ /* Moving the computation from the loop may prolong life range
|
+ /* Do not emit expensive expressions. The rationale is that
|
||||||
+ of some ssa names, which may cause problems if they appear
|
+ when someone writes a code like
|
||||||
+ on abnormal edges. */
|
+
|
||||||
+- || contains_abnormal_ssa_name_p (def))
|
+ while (n > 45) n -= 45;
|
||||||
++ || contains_abnormal_ssa_name_p (def)
|
+
|
||||||
++ /* Do not emit expensive expressions. The rationale is that
|
+ he probably knows that n is not large, and does not want it
|
||||||
++ when someone writes a code like
|
+ to be turned into n %= 45. */
|
||||||
++
|
+ || expression_expensive_p (def))
|
||||||
++ while (n > 45) n -= 45;
|
continue;
|
||||||
++
|
|
||||||
++ he probably knows that n is not large, and does not want it
|
/* Eliminate the PHI node and replace it by a computation outside
|
||||||
++ to be turned into n %= 45. */
|
Index: gcc-4.3.2/gcc/tree-scalar-evolution.h
|
||||||
++ || expression_expensive_p (def))
|
===================================================================
|
||||||
+ continue;
|
--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.h 2009-01-28 10:22:47.000000000 +0100
|
||||||
+
|
+++ gcc-4.3.2/gcc/tree-scalar-evolution.h 2009-01-28 10:23:10.000000000 +0100
|
||||||
+ /* Eliminate the PHI node and replace it by a computation outside
|
@@ -35,6 +35,7 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-scalar-evolution.h
|
extern void scev_analysis (void);
|
||||||
+===================================================================
|
unsigned int scev_const_prop (void);
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.h 2009-01-28 10:22:47.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/tree-scalar-evolution.h 2009-01-28 10:23:10.000000000 +0100
|
+bool expression_expensive_p (tree);
|
||||||
+@@ -35,6 +35,7 @@
|
extern bool simple_iv (struct loop *, tree, tree, affine_iv *, bool);
|
||||||
+ extern void scev_analysis (void);
|
|
||||||
+ unsigned int scev_const_prop (void);
|
/* Returns the loop of the polynomial chrec CHREC. */
|
||||||
+
|
Index: gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c
|
||||||
++bool expression_expensive_p (tree);
|
===================================================================
|
||||||
+ extern bool simple_iv (struct loop *, tree, tree, affine_iv *, bool);
|
--- gcc-4.3.2.orig/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:09.000000000 +0100
|
||||||
+
|
+++ gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:43.000000000 +0100
|
||||||
+ /* Returns the loop of the polynomial chrec CHREC. */
|
@@ -8,5 +8,9 @@
|
||||||
+Index: gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c
|
return ns;
|
||||||
+===================================================================
|
}
|
||||||
+--- gcc-4.3.2.orig/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:09.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:43.000000000 +0100
|
-/* { dg-final { scan-tree-dump "ns % 10000" "optimized" } } */
|
||||||
+@@ -8,5 +8,9 @@
|
+/* This test was originally introduced to test that we transform
|
||||||
+ return ns;
|
+ to ns % 10000. See the discussion of PR 32044 why we do not do
|
||||||
+ }
|
+ that anymore. */
|
||||||
+
|
+/* { dg-final { scan-tree-dump-times "%" 0 "optimized" } } */
|
||||||
+-/* { dg-final { scan-tree-dump "ns % 10000" "optimized" } } */
|
+/* { dg-final { scan-tree-dump-times "/" 0 "optimized" } } */
|
||||||
++/* This test was originally introduced to test that we transform
|
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
||||||
++ to ns % 10000. See the discussion of PR 32044 why we do not do
|
Index: gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c
|
||||||
++ that anymore. */
|
===================================================================
|
||||||
++/* { dg-final { scan-tree-dump-times "%" 0 "optimized" } } */
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
++/* { dg-final { scan-tree-dump-times "/" 0 "optimized" } } */
|
+++ gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c 2009-01-28 10:25:50.000000000 +0100
|
||||||
+ /* { dg-final { cleanup-tree-dump "optimized" } } */
|
@@ -0,0 +1,55 @@
|
||||||
+Index: gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c
|
+/* { dg-do compile } */
|
||||||
+===================================================================
|
+/* { dg-options "-O2 -fdump-tree-empty -fdump-tree-final_cleanup" } */
|
||||||
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
+
|
||||||
++++ gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c 2009-01-28 10:25:50.000000000 +0100
|
+int foo (int n)
|
||||||
+@@ -0,0 +1,55 @@
|
+{
|
||||||
++/* { dg-do compile } */
|
+ while (n >= 45)
|
||||||
++/* { dg-options "-O2 -fdump-tree-empty -fdump-tree-final_cleanup" } */
|
+ n -= 45;
|
||||||
++
|
+
|
||||||
++int foo (int n)
|
+ return n;
|
||||||
++{
|
+}
|
||||||
++ while (n >= 45)
|
+
|
||||||
++ n -= 45;
|
+int bar (int n)
|
||||||
++
|
+{
|
||||||
++ return n;
|
+ while (n >= 64)
|
||||||
++}
|
+ n -= 64;
|
||||||
++
|
+
|
||||||
++int bar (int n)
|
+ return n;
|
||||||
++{
|
+}
|
||||||
++ while (n >= 64)
|
+
|
||||||
++ n -= 64;
|
+int bla (int n)
|
||||||
++
|
+{
|
||||||
++ return n;
|
+ int i = 0;
|
||||||
++}
|
+
|
||||||
++
|
+ while (n >= 45)
|
||||||
++int bla (int n)
|
+ {
|
||||||
++{
|
+ i++;
|
||||||
++ int i = 0;
|
+ n -= 45;
|
||||||
++
|
+ }
|
||||||
++ while (n >= 45)
|
+
|
||||||
++ {
|
+ return i;
|
||||||
++ i++;
|
+}
|
||||||
++ n -= 45;
|
+
|
||||||
++ }
|
+int baz (int n)
|
||||||
++
|
+{
|
||||||
++ return i;
|
+ int i = 0;
|
||||||
++}
|
+
|
||||||
++
|
+ while (n >= 64)
|
||||||
++int baz (int n)
|
+ {
|
||||||
++{
|
+ i++;
|
||||||
++ int i = 0;
|
+ n -= 64;
|
||||||
++
|
+ }
|
||||||
++ while (n >= 64)
|
+
|
||||||
++ {
|
+ return i;
|
||||||
++ i++;
|
+}
|
||||||
++ n -= 64;
|
+
|
||||||
++ }
|
+/* The loops computing division/modulo by 64 should be eliminated. */
|
||||||
++
|
+/* { dg-final { scan-tree-dump-times "Removing empty loop" 2 "empty" } } */
|
||||||
++ return i;
|
+
|
||||||
++}
|
+/* There should be no division/modulo in the final dump (division and modulo
|
||||||
++
|
+ by 64 are done using bit operations). */
|
||||||
++/* The loops computing division/modulo by 64 should be eliminated. */
|
+/* { dg-final { scan-tree-dump-times "/" 0 "final_cleanup" } } */
|
||||||
++/* { dg-final { scan-tree-dump-times "Removing empty loop" 2 "empty" } } */
|
+/* { dg-final { scan-tree-dump-times "%" 0 "final_cleanup" } } */
|
||||||
++
|
+
|
||||||
++/* There should be no division/modulo in the final dump (division and modulo
|
+/* { dg-final { cleanup-tree-dump "empty" } } */
|
||||||
++ by 64 are done using bit operations). */
|
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
|
||||||
++/* { dg-final { scan-tree-dump-times "/" 0 "final_cleanup" } } */
|
Index: gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c
|
||||||
++/* { dg-final { scan-tree-dump-times "%" 0 "final_cleanup" } } */
|
===================================================================
|
||||||
++
|
--- gcc-4.3.2.orig/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:26:04.000000000 +0100
|
||||||
++/* { dg-final { cleanup-tree-dump "empty" } } */
|
+++ gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:27:09.000000000 +0100
|
||||||
++/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
|
@@ -3778,7 +3778,12 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c
|
return false;
|
||||||
+===================================================================
|
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:26:04.000000000 +0100
|
cand_value_at (loop, cand, use->stmt, nit, &bnd);
|
||||||
++++ gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:27:09.000000000 +0100
|
+
|
||||||
+@@ -3778,7 +3778,12 @@
|
*bound = aff_combination_to_tree (&bnd);
|
||||||
+ return false;
|
+ /* It is unlikely that computing the number of iterations using division
|
||||||
+
|
+ would be more profitable than keeping the original induction variable. */
|
||||||
+ cand_value_at (loop, cand, use->stmt, nit, &bnd);
|
+ if (expression_expensive_p (*bound))
|
||||||
++
|
+ return false;
|
||||||
+ *bound = aff_combination_to_tree (&bnd);
|
return true;
|
||||||
++ /* It is unlikely that computing the number of iterations using division
|
}
|
||||||
++ would be more profitable than keeping the original induction variable. */
|
|
||||||
++ if (expression_expensive_p (*bound))
|
|
||||||
++ return false;
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
|
@ -1,193 +1,188 @@
|
|||||||
Index: toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch
|
Index: gcc-4.3.2/gcc/tree-scalar-evolution.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch (revision 0)
|
--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.c 2009-01-28 10:14:37.000000000 +0100
|
||||||
+++ toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch (revision 0)
|
+++ gcc-4.3.2/gcc/tree-scalar-evolution.c 2009-01-28 10:17:50.000000000 +0100
|
||||||
@@ -0,0 +1,188 @@
|
@@ -2716,6 +2716,50 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-scalar-evolution.c
|
scalar_evolution_info = NULL;
|
||||||
+===================================================================
|
}
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.c 2009-01-28 10:14:37.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/tree-scalar-evolution.c 2009-01-28 10:17:50.000000000 +0100
|
+/* Returns true if the expression EXPR is considered to be too expensive
|
||||||
+@@ -2716,6 +2716,50 @@
|
+ for scev_const_prop. */
|
||||||
+ scalar_evolution_info = NULL;
|
+
|
||||||
+ }
|
+bool
|
||||||
+
|
+expression_expensive_p (tree expr)
|
||||||
++/* Returns true if the expression EXPR is considered to be too expensive
|
+{
|
||||||
++ for scev_const_prop. */
|
+ enum tree_code code;
|
||||||
++
|
+
|
||||||
++bool
|
+ if (is_gimple_val (expr))
|
||||||
++expression_expensive_p (tree expr)
|
+ return false;
|
||||||
++{
|
+
|
||||||
++ enum tree_code code;
|
+ code = TREE_CODE (expr);
|
||||||
++
|
+ if (code == TRUNC_DIV_EXPR
|
||||||
++ if (is_gimple_val (expr))
|
+ || code == CEIL_DIV_EXPR
|
||||||
++ return false;
|
+ || code == FLOOR_DIV_EXPR
|
||||||
++
|
+ || code == ROUND_DIV_EXPR
|
||||||
++ code = TREE_CODE (expr);
|
+ || code == TRUNC_MOD_EXPR
|
||||||
++ if (code == TRUNC_DIV_EXPR
|
+ || code == CEIL_MOD_EXPR
|
||||||
++ || code == CEIL_DIV_EXPR
|
+ || code == FLOOR_MOD_EXPR
|
||||||
++ || code == FLOOR_DIV_EXPR
|
+ || code == ROUND_MOD_EXPR
|
||||||
++ || code == ROUND_DIV_EXPR
|
+ || code == EXACT_DIV_EXPR)
|
||||||
++ || code == TRUNC_MOD_EXPR
|
+ {
|
||||||
++ || code == CEIL_MOD_EXPR
|
+ /* Division by power of two is usually cheap, so we allow it.
|
||||||
++ || code == FLOOR_MOD_EXPR
|
+ Forbid anything else. */
|
||||||
++ || code == ROUND_MOD_EXPR
|
+ if (!integer_pow2p (TREE_OPERAND (expr, 1)))
|
||||||
++ || code == EXACT_DIV_EXPR)
|
+ return true;
|
||||||
++ {
|
+ }
|
||||||
++ /* Division by power of two is usually cheap, so we allow it.
|
+
|
||||||
++ Forbid anything else. */
|
+ switch (TREE_CODE_CLASS (code))
|
||||||
++ if (!integer_pow2p (TREE_OPERAND (expr, 1)))
|
+ {
|
||||||
++ return true;
|
+ case tcc_binary:
|
||||||
++ }
|
+ case tcc_comparison:
|
||||||
++
|
+ if (expression_expensive_p (TREE_OPERAND (expr, 1)))
|
||||||
++ switch (TREE_CODE_CLASS (code))
|
+ return true;
|
||||||
++ {
|
+
|
||||||
++ case tcc_binary:
|
+ /* Fallthru. */
|
||||||
++ case tcc_comparison:
|
+ case tcc_unary:
|
||||||
++ if (expression_expensive_p (TREE_OPERAND (expr, 1)))
|
+ return expression_expensive_p (TREE_OPERAND (expr, 0));
|
||||||
++ return true;
|
+
|
||||||
++
|
+ default:
|
||||||
++ /* Fallthru. */
|
+ return true;
|
||||||
++ case tcc_unary:
|
+ }
|
||||||
++ return expression_expensive_p (TREE_OPERAND (expr, 0));
|
+}
|
||||||
++
|
+
|
||||||
++ default:
|
/* Replace ssa names for that scev can prove they are constant by the
|
||||||
++ return true;
|
appropriate constants. Also perform final value replacement in loops,
|
||||||
++ }
|
in case the replacement expressions are cheap.
|
||||||
++}
|
@@ -2802,12 +2846,6 @@
|
||||||
++
|
continue;
|
||||||
+ /* Replace ssa names for that scev can prove they are constant by the
|
|
||||||
+ appropriate constants. Also perform final value replacement in loops,
|
niter = number_of_latch_executions (loop);
|
||||||
+ in case the replacement expressions are cheap.
|
- /* We used to check here whether the computation of NITER is expensive,
|
||||||
+@@ -2802,12 +2846,6 @@
|
- and avoided final value elimination if that is the case. The problem
|
||||||
+ continue;
|
- is that it is hard to evaluate whether the expression is too
|
||||||
+
|
- expensive, as we do not know what optimization opportunities the
|
||||||
+ niter = number_of_latch_executions (loop);
|
- the elimination of the final value may reveal. Therefore, we now
|
||||||
+- /* We used to check here whether the computation of NITER is expensive,
|
- eliminate the final values of induction variables unconditionally. */
|
||||||
+- and avoided final value elimination if that is the case. The problem
|
if (niter == chrec_dont_know)
|
||||||
+- is that it is hard to evaluate whether the expression is too
|
continue;
|
||||||
+- expensive, as we do not know what optimization opportunities the
|
|
||||||
+- the elimination of the final value may reveal. Therefore, we now
|
@@ -2838,7 +2876,15 @@
|
||||||
+- eliminate the final values of induction variables unconditionally. */
|
/* Moving the computation from the loop may prolong life range
|
||||||
+ if (niter == chrec_dont_know)
|
of some ssa names, which may cause problems if they appear
|
||||||
+ continue;
|
on abnormal edges. */
|
||||||
+
|
- || contains_abnormal_ssa_name_p (def))
|
||||||
+@@ -2838,7 +2876,15 @@
|
+ || contains_abnormal_ssa_name_p (def)
|
||||||
+ /* Moving the computation from the loop may prolong life range
|
+ /* Do not emit expensive expressions. The rationale is that
|
||||||
+ of some ssa names, which may cause problems if they appear
|
+ when someone writes a code like
|
||||||
+ on abnormal edges. */
|
+
|
||||||
+- || contains_abnormal_ssa_name_p (def))
|
+ while (n > 45) n -= 45;
|
||||||
++ || contains_abnormal_ssa_name_p (def)
|
+
|
||||||
++ /* Do not emit expensive expressions. The rationale is that
|
+ he probably knows that n is not large, and does not want it
|
||||||
++ when someone writes a code like
|
+ to be turned into n %= 45. */
|
||||||
++
|
+ || expression_expensive_p (def))
|
||||||
++ while (n > 45) n -= 45;
|
continue;
|
||||||
++
|
|
||||||
++ he probably knows that n is not large, and does not want it
|
/* Eliminate the PHI node and replace it by a computation outside
|
||||||
++ to be turned into n %= 45. */
|
Index: gcc-4.3.2/gcc/tree-scalar-evolution.h
|
||||||
++ || expression_expensive_p (def))
|
===================================================================
|
||||||
+ continue;
|
--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.h 2009-01-28 10:22:47.000000000 +0100
|
||||||
+
|
+++ gcc-4.3.2/gcc/tree-scalar-evolution.h 2009-01-28 10:23:10.000000000 +0100
|
||||||
+ /* Eliminate the PHI node and replace it by a computation outside
|
@@ -35,6 +35,7 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-scalar-evolution.h
|
extern void scev_analysis (void);
|
||||||
+===================================================================
|
unsigned int scev_const_prop (void);
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.h 2009-01-28 10:22:47.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/tree-scalar-evolution.h 2009-01-28 10:23:10.000000000 +0100
|
+bool expression_expensive_p (tree);
|
||||||
+@@ -35,6 +35,7 @@
|
extern bool simple_iv (struct loop *, tree, tree, affine_iv *, bool);
|
||||||
+ extern void scev_analysis (void);
|
|
||||||
+ unsigned int scev_const_prop (void);
|
/* Returns the loop of the polynomial chrec CHREC. */
|
||||||
+
|
Index: gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c
|
||||||
++bool expression_expensive_p (tree);
|
===================================================================
|
||||||
+ extern bool simple_iv (struct loop *, tree, tree, affine_iv *, bool);
|
--- gcc-4.3.2.orig/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:09.000000000 +0100
|
||||||
+
|
+++ gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:43.000000000 +0100
|
||||||
+ /* Returns the loop of the polynomial chrec CHREC. */
|
@@ -8,5 +8,9 @@
|
||||||
+Index: gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c
|
return ns;
|
||||||
+===================================================================
|
}
|
||||||
+--- gcc-4.3.2.orig/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:09.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:43.000000000 +0100
|
-/* { dg-final { scan-tree-dump "ns % 10000" "optimized" } } */
|
||||||
+@@ -8,5 +8,9 @@
|
+/* This test was originally introduced to test that we transform
|
||||||
+ return ns;
|
+ to ns % 10000. See the discussion of PR 32044 why we do not do
|
||||||
+ }
|
+ that anymore. */
|
||||||
+
|
+/* { dg-final { scan-tree-dump-times "%" 0 "optimized" } } */
|
||||||
+-/* { dg-final { scan-tree-dump "ns % 10000" "optimized" } } */
|
+/* { dg-final { scan-tree-dump-times "/" 0 "optimized" } } */
|
||||||
++/* This test was originally introduced to test that we transform
|
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
||||||
++ to ns % 10000. See the discussion of PR 32044 why we do not do
|
Index: gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c
|
||||||
++ that anymore. */
|
===================================================================
|
||||||
++/* { dg-final { scan-tree-dump-times "%" 0 "optimized" } } */
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
++/* { dg-final { scan-tree-dump-times "/" 0 "optimized" } } */
|
+++ gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c 2009-01-28 10:25:50.000000000 +0100
|
||||||
+ /* { dg-final { cleanup-tree-dump "optimized" } } */
|
@@ -0,0 +1,55 @@
|
||||||
+Index: gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c
|
+/* { dg-do compile } */
|
||||||
+===================================================================
|
+/* { dg-options "-O2 -fdump-tree-empty -fdump-tree-final_cleanup" } */
|
||||||
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
+
|
||||||
++++ gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c 2009-01-28 10:25:50.000000000 +0100
|
+int foo (int n)
|
||||||
+@@ -0,0 +1,55 @@
|
+{
|
||||||
++/* { dg-do compile } */
|
+ while (n >= 45)
|
||||||
++/* { dg-options "-O2 -fdump-tree-empty -fdump-tree-final_cleanup" } */
|
+ n -= 45;
|
||||||
++
|
+
|
||||||
++int foo (int n)
|
+ return n;
|
||||||
++{
|
+}
|
||||||
++ while (n >= 45)
|
+
|
||||||
++ n -= 45;
|
+int bar (int n)
|
||||||
++
|
+{
|
||||||
++ return n;
|
+ while (n >= 64)
|
||||||
++}
|
+ n -= 64;
|
||||||
++
|
+
|
||||||
++int bar (int n)
|
+ return n;
|
||||||
++{
|
+}
|
||||||
++ while (n >= 64)
|
+
|
||||||
++ n -= 64;
|
+int bla (int n)
|
||||||
++
|
+{
|
||||||
++ return n;
|
+ int i = 0;
|
||||||
++}
|
+
|
||||||
++
|
+ while (n >= 45)
|
||||||
++int bla (int n)
|
+ {
|
||||||
++{
|
+ i++;
|
||||||
++ int i = 0;
|
+ n -= 45;
|
||||||
++
|
+ }
|
||||||
++ while (n >= 45)
|
+
|
||||||
++ {
|
+ return i;
|
||||||
++ i++;
|
+}
|
||||||
++ n -= 45;
|
+
|
||||||
++ }
|
+int baz (int n)
|
||||||
++
|
+{
|
||||||
++ return i;
|
+ int i = 0;
|
||||||
++}
|
+
|
||||||
++
|
+ while (n >= 64)
|
||||||
++int baz (int n)
|
+ {
|
||||||
++{
|
+ i++;
|
||||||
++ int i = 0;
|
+ n -= 64;
|
||||||
++
|
+ }
|
||||||
++ while (n >= 64)
|
+
|
||||||
++ {
|
+ return i;
|
||||||
++ i++;
|
+}
|
||||||
++ n -= 64;
|
+
|
||||||
++ }
|
+/* The loops computing division/modulo by 64 should be eliminated. */
|
||||||
++
|
+/* { dg-final { scan-tree-dump-times "Removing empty loop" 2 "empty" } } */
|
||||||
++ return i;
|
+
|
||||||
++}
|
+/* There should be no division/modulo in the final dump (division and modulo
|
||||||
++
|
+ by 64 are done using bit operations). */
|
||||||
++/* The loops computing division/modulo by 64 should be eliminated. */
|
+/* { dg-final { scan-tree-dump-times "/" 0 "final_cleanup" } } */
|
||||||
++/* { dg-final { scan-tree-dump-times "Removing empty loop" 2 "empty" } } */
|
+/* { dg-final { scan-tree-dump-times "%" 0 "final_cleanup" } } */
|
||||||
++
|
+
|
||||||
++/* There should be no division/modulo in the final dump (division and modulo
|
+/* { dg-final { cleanup-tree-dump "empty" } } */
|
||||||
++ by 64 are done using bit operations). */
|
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
|
||||||
++/* { dg-final { scan-tree-dump-times "/" 0 "final_cleanup" } } */
|
Index: gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c
|
||||||
++/* { dg-final { scan-tree-dump-times "%" 0 "final_cleanup" } } */
|
===================================================================
|
||||||
++
|
--- gcc-4.3.2.orig/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:26:04.000000000 +0100
|
||||||
++/* { dg-final { cleanup-tree-dump "empty" } } */
|
+++ gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:27:09.000000000 +0100
|
||||||
++/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
|
@@ -3778,7 +3778,12 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c
|
return false;
|
||||||
+===================================================================
|
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:26:04.000000000 +0100
|
cand_value_at (loop, cand, use->stmt, nit, &bnd);
|
||||||
++++ gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:27:09.000000000 +0100
|
+
|
||||||
+@@ -3778,7 +3778,12 @@
|
*bound = aff_combination_to_tree (&bnd);
|
||||||
+ return false;
|
+ /* It is unlikely that computing the number of iterations using division
|
||||||
+
|
+ would be more profitable than keeping the original induction variable. */
|
||||||
+ cand_value_at (loop, cand, use->stmt, nit, &bnd);
|
+ if (expression_expensive_p (*bound))
|
||||||
++
|
+ return false;
|
||||||
+ *bound = aff_combination_to_tree (&bnd);
|
return true;
|
||||||
++ /* It is unlikely that computing the number of iterations using division
|
}
|
||||||
++ would be more profitable than keeping the original induction variable. */
|
|
||||||
++ if (expression_expensive_p (*bound))
|
|
||||||
++ return false;
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
|
@ -1,193 +1,188 @@
|
|||||||
Index: toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch
|
Index: gcc-4.3.2/gcc/tree-scalar-evolution.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch (revision 0)
|
--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.c 2009-01-28 10:14:37.000000000 +0100
|
||||||
+++ toolchain/gcc/4.3.2/901-backport-fix-for-bug-32044.patch (revision 0)
|
+++ gcc-4.3.2/gcc/tree-scalar-evolution.c 2009-01-28 10:17:50.000000000 +0100
|
||||||
@@ -0,0 +1,188 @@
|
@@ -2716,6 +2716,50 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-scalar-evolution.c
|
scalar_evolution_info = NULL;
|
||||||
+===================================================================
|
}
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.c 2009-01-28 10:14:37.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/tree-scalar-evolution.c 2009-01-28 10:17:50.000000000 +0100
|
+/* Returns true if the expression EXPR is considered to be too expensive
|
||||||
+@@ -2716,6 +2716,50 @@
|
+ for scev_const_prop. */
|
||||||
+ scalar_evolution_info = NULL;
|
+
|
||||||
+ }
|
+bool
|
||||||
+
|
+expression_expensive_p (tree expr)
|
||||||
++/* Returns true if the expression EXPR is considered to be too expensive
|
+{
|
||||||
++ for scev_const_prop. */
|
+ enum tree_code code;
|
||||||
++
|
+
|
||||||
++bool
|
+ if (is_gimple_val (expr))
|
||||||
++expression_expensive_p (tree expr)
|
+ return false;
|
||||||
++{
|
+
|
||||||
++ enum tree_code code;
|
+ code = TREE_CODE (expr);
|
||||||
++
|
+ if (code == TRUNC_DIV_EXPR
|
||||||
++ if (is_gimple_val (expr))
|
+ || code == CEIL_DIV_EXPR
|
||||||
++ return false;
|
+ || code == FLOOR_DIV_EXPR
|
||||||
++
|
+ || code == ROUND_DIV_EXPR
|
||||||
++ code = TREE_CODE (expr);
|
+ || code == TRUNC_MOD_EXPR
|
||||||
++ if (code == TRUNC_DIV_EXPR
|
+ || code == CEIL_MOD_EXPR
|
||||||
++ || code == CEIL_DIV_EXPR
|
+ || code == FLOOR_MOD_EXPR
|
||||||
++ || code == FLOOR_DIV_EXPR
|
+ || code == ROUND_MOD_EXPR
|
||||||
++ || code == ROUND_DIV_EXPR
|
+ || code == EXACT_DIV_EXPR)
|
||||||
++ || code == TRUNC_MOD_EXPR
|
+ {
|
||||||
++ || code == CEIL_MOD_EXPR
|
+ /* Division by power of two is usually cheap, so we allow it.
|
||||||
++ || code == FLOOR_MOD_EXPR
|
+ Forbid anything else. */
|
||||||
++ || code == ROUND_MOD_EXPR
|
+ if (!integer_pow2p (TREE_OPERAND (expr, 1)))
|
||||||
++ || code == EXACT_DIV_EXPR)
|
+ return true;
|
||||||
++ {
|
+ }
|
||||||
++ /* Division by power of two is usually cheap, so we allow it.
|
+
|
||||||
++ Forbid anything else. */
|
+ switch (TREE_CODE_CLASS (code))
|
||||||
++ if (!integer_pow2p (TREE_OPERAND (expr, 1)))
|
+ {
|
||||||
++ return true;
|
+ case tcc_binary:
|
||||||
++ }
|
+ case tcc_comparison:
|
||||||
++
|
+ if (expression_expensive_p (TREE_OPERAND (expr, 1)))
|
||||||
++ switch (TREE_CODE_CLASS (code))
|
+ return true;
|
||||||
++ {
|
+
|
||||||
++ case tcc_binary:
|
+ /* Fallthru. */
|
||||||
++ case tcc_comparison:
|
+ case tcc_unary:
|
||||||
++ if (expression_expensive_p (TREE_OPERAND (expr, 1)))
|
+ return expression_expensive_p (TREE_OPERAND (expr, 0));
|
||||||
++ return true;
|
+
|
||||||
++
|
+ default:
|
||||||
++ /* Fallthru. */
|
+ return true;
|
||||||
++ case tcc_unary:
|
+ }
|
||||||
++ return expression_expensive_p (TREE_OPERAND (expr, 0));
|
+}
|
||||||
++
|
+
|
||||||
++ default:
|
/* Replace ssa names for that scev can prove they are constant by the
|
||||||
++ return true;
|
appropriate constants. Also perform final value replacement in loops,
|
||||||
++ }
|
in case the replacement expressions are cheap.
|
||||||
++}
|
@@ -2802,12 +2846,6 @@
|
||||||
++
|
continue;
|
||||||
+ /* Replace ssa names for that scev can prove they are constant by the
|
|
||||||
+ appropriate constants. Also perform final value replacement in loops,
|
niter = number_of_latch_executions (loop);
|
||||||
+ in case the replacement expressions are cheap.
|
- /* We used to check here whether the computation of NITER is expensive,
|
||||||
+@@ -2802,12 +2846,6 @@
|
- and avoided final value elimination if that is the case. The problem
|
||||||
+ continue;
|
- is that it is hard to evaluate whether the expression is too
|
||||||
+
|
- expensive, as we do not know what optimization opportunities the
|
||||||
+ niter = number_of_latch_executions (loop);
|
- the elimination of the final value may reveal. Therefore, we now
|
||||||
+- /* We used to check here whether the computation of NITER is expensive,
|
- eliminate the final values of induction variables unconditionally. */
|
||||||
+- and avoided final value elimination if that is the case. The problem
|
if (niter == chrec_dont_know)
|
||||||
+- is that it is hard to evaluate whether the expression is too
|
continue;
|
||||||
+- expensive, as we do not know what optimization opportunities the
|
|
||||||
+- the elimination of the final value may reveal. Therefore, we now
|
@@ -2838,7 +2876,15 @@
|
||||||
+- eliminate the final values of induction variables unconditionally. */
|
/* Moving the computation from the loop may prolong life range
|
||||||
+ if (niter == chrec_dont_know)
|
of some ssa names, which may cause problems if they appear
|
||||||
+ continue;
|
on abnormal edges. */
|
||||||
+
|
- || contains_abnormal_ssa_name_p (def))
|
||||||
+@@ -2838,7 +2876,15 @@
|
+ || contains_abnormal_ssa_name_p (def)
|
||||||
+ /* Moving the computation from the loop may prolong life range
|
+ /* Do not emit expensive expressions. The rationale is that
|
||||||
+ of some ssa names, which may cause problems if they appear
|
+ when someone writes a code like
|
||||||
+ on abnormal edges. */
|
+
|
||||||
+- || contains_abnormal_ssa_name_p (def))
|
+ while (n > 45) n -= 45;
|
||||||
++ || contains_abnormal_ssa_name_p (def)
|
+
|
||||||
++ /* Do not emit expensive expressions. The rationale is that
|
+ he probably knows that n is not large, and does not want it
|
||||||
++ when someone writes a code like
|
+ to be turned into n %= 45. */
|
||||||
++
|
+ || expression_expensive_p (def))
|
||||||
++ while (n > 45) n -= 45;
|
continue;
|
||||||
++
|
|
||||||
++ he probably knows that n is not large, and does not want it
|
/* Eliminate the PHI node and replace it by a computation outside
|
||||||
++ to be turned into n %= 45. */
|
Index: gcc-4.3.2/gcc/tree-scalar-evolution.h
|
||||||
++ || expression_expensive_p (def))
|
===================================================================
|
||||||
+ continue;
|
--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.h 2009-01-28 10:22:47.000000000 +0100
|
||||||
+
|
+++ gcc-4.3.2/gcc/tree-scalar-evolution.h 2009-01-28 10:23:10.000000000 +0100
|
||||||
+ /* Eliminate the PHI node and replace it by a computation outside
|
@@ -35,6 +35,7 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-scalar-evolution.h
|
extern void scev_analysis (void);
|
||||||
+===================================================================
|
unsigned int scev_const_prop (void);
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-scalar-evolution.h 2009-01-28 10:22:47.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/tree-scalar-evolution.h 2009-01-28 10:23:10.000000000 +0100
|
+bool expression_expensive_p (tree);
|
||||||
+@@ -35,6 +35,7 @@
|
extern bool simple_iv (struct loop *, tree, tree, affine_iv *, bool);
|
||||||
+ extern void scev_analysis (void);
|
|
||||||
+ unsigned int scev_const_prop (void);
|
/* Returns the loop of the polynomial chrec CHREC. */
|
||||||
+
|
Index: gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c
|
||||||
++bool expression_expensive_p (tree);
|
===================================================================
|
||||||
+ extern bool simple_iv (struct loop *, tree, tree, affine_iv *, bool);
|
--- gcc-4.3.2.orig/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:09.000000000 +0100
|
||||||
+
|
+++ gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:43.000000000 +0100
|
||||||
+ /* Returns the loop of the polynomial chrec CHREC. */
|
@@ -8,5 +8,9 @@
|
||||||
+Index: gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c
|
return ns;
|
||||||
+===================================================================
|
}
|
||||||
+--- gcc-4.3.2.orig/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:09.000000000 +0100
|
|
||||||
++++ gcc-4.3.2/gcc/testsuite/gcc.dg/pr34027-1.c 2009-01-28 10:24:43.000000000 +0100
|
-/* { dg-final { scan-tree-dump "ns % 10000" "optimized" } } */
|
||||||
+@@ -8,5 +8,9 @@
|
+/* This test was originally introduced to test that we transform
|
||||||
+ return ns;
|
+ to ns % 10000. See the discussion of PR 32044 why we do not do
|
||||||
+ }
|
+ that anymore. */
|
||||||
+
|
+/* { dg-final { scan-tree-dump-times "%" 0 "optimized" } } */
|
||||||
+-/* { dg-final { scan-tree-dump "ns % 10000" "optimized" } } */
|
+/* { dg-final { scan-tree-dump-times "/" 0 "optimized" } } */
|
||||||
++/* This test was originally introduced to test that we transform
|
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
||||||
++ to ns % 10000. See the discussion of PR 32044 why we do not do
|
Index: gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c
|
||||||
++ that anymore. */
|
===================================================================
|
||||||
++/* { dg-final { scan-tree-dump-times "%" 0 "optimized" } } */
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
++/* { dg-final { scan-tree-dump-times "/" 0 "optimized" } } */
|
+++ gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c 2009-01-28 10:25:50.000000000 +0100
|
||||||
+ /* { dg-final { cleanup-tree-dump "optimized" } } */
|
@@ -0,0 +1,55 @@
|
||||||
+Index: gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c
|
+/* { dg-do compile } */
|
||||||
+===================================================================
|
+/* { dg-options "-O2 -fdump-tree-empty -fdump-tree-final_cleanup" } */
|
||||||
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
+
|
||||||
++++ gcc-4.3.2/gcc/testsuite/gcc.dg/tree-ssa/pr32044.c 2009-01-28 10:25:50.000000000 +0100
|
+int foo (int n)
|
||||||
+@@ -0,0 +1,55 @@
|
+{
|
||||||
++/* { dg-do compile } */
|
+ while (n >= 45)
|
||||||
++/* { dg-options "-O2 -fdump-tree-empty -fdump-tree-final_cleanup" } */
|
+ n -= 45;
|
||||||
++
|
+
|
||||||
++int foo (int n)
|
+ return n;
|
||||||
++{
|
+}
|
||||||
++ while (n >= 45)
|
+
|
||||||
++ n -= 45;
|
+int bar (int n)
|
||||||
++
|
+{
|
||||||
++ return n;
|
+ while (n >= 64)
|
||||||
++}
|
+ n -= 64;
|
||||||
++
|
+
|
||||||
++int bar (int n)
|
+ return n;
|
||||||
++{
|
+}
|
||||||
++ while (n >= 64)
|
+
|
||||||
++ n -= 64;
|
+int bla (int n)
|
||||||
++
|
+{
|
||||||
++ return n;
|
+ int i = 0;
|
||||||
++}
|
+
|
||||||
++
|
+ while (n >= 45)
|
||||||
++int bla (int n)
|
+ {
|
||||||
++{
|
+ i++;
|
||||||
++ int i = 0;
|
+ n -= 45;
|
||||||
++
|
+ }
|
||||||
++ while (n >= 45)
|
+
|
||||||
++ {
|
+ return i;
|
||||||
++ i++;
|
+}
|
||||||
++ n -= 45;
|
+
|
||||||
++ }
|
+int baz (int n)
|
||||||
++
|
+{
|
||||||
++ return i;
|
+ int i = 0;
|
||||||
++}
|
+
|
||||||
++
|
+ while (n >= 64)
|
||||||
++int baz (int n)
|
+ {
|
||||||
++{
|
+ i++;
|
||||||
++ int i = 0;
|
+ n -= 64;
|
||||||
++
|
+ }
|
||||||
++ while (n >= 64)
|
+
|
||||||
++ {
|
+ return i;
|
||||||
++ i++;
|
+}
|
||||||
++ n -= 64;
|
+
|
||||||
++ }
|
+/* The loops computing division/modulo by 64 should be eliminated. */
|
||||||
++
|
+/* { dg-final { scan-tree-dump-times "Removing empty loop" 2 "empty" } } */
|
||||||
++ return i;
|
+
|
||||||
++}
|
+/* There should be no division/modulo in the final dump (division and modulo
|
||||||
++
|
+ by 64 are done using bit operations). */
|
||||||
++/* The loops computing division/modulo by 64 should be eliminated. */
|
+/* { dg-final { scan-tree-dump-times "/" 0 "final_cleanup" } } */
|
||||||
++/* { dg-final { scan-tree-dump-times "Removing empty loop" 2 "empty" } } */
|
+/* { dg-final { scan-tree-dump-times "%" 0 "final_cleanup" } } */
|
||||||
++
|
+
|
||||||
++/* There should be no division/modulo in the final dump (division and modulo
|
+/* { dg-final { cleanup-tree-dump "empty" } } */
|
||||||
++ by 64 are done using bit operations). */
|
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
|
||||||
++/* { dg-final { scan-tree-dump-times "/" 0 "final_cleanup" } } */
|
Index: gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c
|
||||||
++/* { dg-final { scan-tree-dump-times "%" 0 "final_cleanup" } } */
|
===================================================================
|
||||||
++
|
--- gcc-4.3.2.orig/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:26:04.000000000 +0100
|
||||||
++/* { dg-final { cleanup-tree-dump "empty" } } */
|
+++ gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:27:09.000000000 +0100
|
||||||
++/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
|
@@ -3778,7 +3778,12 @@
|
||||||
+Index: gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c
|
return false;
|
||||||
+===================================================================
|
|
||||||
+--- gcc-4.3.2.orig/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:26:04.000000000 +0100
|
cand_value_at (loop, cand, use->stmt, nit, &bnd);
|
||||||
++++ gcc-4.3.2/gcc/tree-ssa-loop-ivopts.c 2009-01-28 10:27:09.000000000 +0100
|
+
|
||||||
+@@ -3778,7 +3778,12 @@
|
*bound = aff_combination_to_tree (&bnd);
|
||||||
+ return false;
|
+ /* It is unlikely that computing the number of iterations using division
|
||||||
+
|
+ would be more profitable than keeping the original induction variable. */
|
||||||
+ cand_value_at (loop, cand, use->stmt, nit, &bnd);
|
+ if (expression_expensive_p (*bound))
|
||||||
++
|
+ return false;
|
||||||
+ *bound = aff_combination_to_tree (&bnd);
|
return true;
|
||||||
++ /* It is unlikely that computing the number of iterations using division
|
}
|
||||||
++ would be more profitable than keeping the original induction variable. */
|
|
||||||
++ if (expression_expensive_p (*bound))
|
|
||||||
++ return false;
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user