]> git.pld-linux.org Git - packages/gcc.git/blob - gcc-pr25248.patch
This commit was manufactured by cvs2git to create branch 'GCC_4_1'.
[packages/gcc.git] / gcc-pr25248.patch
1 Date: Tue, 6 Dec 2005 21:31:58 +0100
2 From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
3 Subject: [patch] for PR 25248
4
5 Hello,
6
7 when follow_ssa_edge_in_rhs analyzes expression of form a + b, it first
8 tries to analyze a, and if it fails, analyzes b.  The results are
9 accumulated to evolution_of_loop.  However, the failed attempt to analyze 'a' may
10 modify contents of evolution_of_loop; the result of analysis of 'b' is
11 then combined with it, which produces a wrong result.  Fixed by using a
12 temporary variable to store the result in the analysis of 'a'.
13
14 Bootstrapped & regtested on i686 and ppc64.
15
16 Zdenek
17
18         PR tree-optimization/25248
19         * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Do not use
20         evolution_of_loop from the failed attempt.
21
22 Index: tree-scalar-evolution.c
23 ===================================================================
24 *** gcc/gcc/tree-scalar-evolution.c     (revision 108078)
25 --- gcc/gcc/tree-scalar-evolution.c     (working copy)
26 *************** follow_ssa_edge_in_rhs (struct loop *loo
27 *** 1042,1047 ****
28 --- 1042,1048 ----
29     t_bool res = t_false;
30     tree rhs0, rhs1;
31     tree type_rhs = TREE_TYPE (rhs);
32 +   tree evol;
33     
34     /* The RHS is one of the following cases:
35        - an SSA_NAME, 
36 *************** follow_ssa_edge_in_rhs (struct loop *loo
37 *** 1084,1097 ****
38             {
39               /* Match an assignment under the form: 
40                  "a = b + c".  */
41               res = follow_ssa_edge 
42                 (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, 
43 !                evolution_of_loop, limit);
44               
45               if (res == t_true)
46                 *evolution_of_loop = add_to_evolution 
47                   (loop->num, 
48 !                  chrec_convert (type_rhs, *evolution_of_loop, at_stmt), 
49                    PLUS_EXPR, rhs1);
50               
51               else if (res == t_false)
52 --- 1085,1099 ----
53             {
54               /* Match an assignment under the form: 
55                  "a = b + c".  */
56 +             evol = *evolution_of_loop;
57               res = follow_ssa_edge 
58                 (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, 
59 !                &evol, limit);
60               
61               if (res == t_true)
62                 *evolution_of_loop = add_to_evolution 
63                   (loop->num, 
64 !                  chrec_convert (type_rhs, evol, at_stmt), 
65                    PLUS_EXPR, rhs1);
66               
67               else if (res == t_false)
This page took 0.053529 seconds and 3 git commands to generate.