]> git.pld-linux.org Git - packages/gcc.git/blame - gcc-pr23386.patch
- a collection of four separate patches, needed to implement
[packages/gcc.git] / gcc-pr23386.patch
CommitLineData
0c7a192e
PS
1--- gcc/gcc/tree-data-ref.c 2005/08/14 06:28:03 2.37
2+++ gcc/gcc/tree-data-ref.c 2005/08/15 07:51:39 2.38
3@@ -751,7 +751,7 @@
4 tree access_fn,
5 tree stmt)
6 {
7- tree estimation;
8+ tree estimation = NULL_TREE;
9 tree array_size, data_size, element_size;
10 tree init, step;
11
12@@ -773,11 +773,28 @@
13 && TREE_CODE (init) == INTEGER_CST
14 && TREE_CODE (step) == INTEGER_CST)
15 {
16- estimation = fold_build2 (CEIL_DIV_EXPR, integer_type_node,
17- fold_build2 (MINUS_EXPR, integer_type_node,
18- data_size, init), step);
19+ tree i_plus_s = fold_build2 (PLUS_EXPR, integer_type_node, init, step);
20+ tree sign = fold_build2 (GT_EXPR, boolean_type_node, i_plus_s, init);
21
22- record_estimate (loop, estimation, boolean_true_node, stmt);
23+ if (sign == boolean_true_node)
24+ estimation = fold_build2 (CEIL_DIV_EXPR, integer_type_node,
25+ fold_build2 (MINUS_EXPR, integer_type_node,
26+ data_size, init), step);
27+
28+ /* When the step is negative, as in PR23386: (init = 3, step =
29+ 0ffffffff, data_size = 100), we have to compute the
30+ estimation as ceil_div (init, 0 - step) + 1. */
31+ else if (sign == boolean_false_node)
32+ estimation =
33+ fold_build2 (PLUS_EXPR, integer_type_node,
34+ fold_build2 (CEIL_DIV_EXPR, integer_type_node,
35+ init,
36+ fold_build2 (MINUS_EXPR, unsigned_type_node,
37+ integer_zero_node, step)),
38+ integer_one_node);
39+
40+ if (estimation)
41+ record_estimate (loop, estimation, boolean_true_node, stmt);
42 }
43 }
44
This page took 0.100135 seconds and 4 git commands to generate.