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
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'.
14 Bootstrapped & regtested on i686 and ppc64.
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.
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
31 tree type_rhs = TREE_TYPE (rhs);
34 /* The RHS is one of the following cases:
36 *************** follow_ssa_edge_in_rhs (struct loop *loo
39 /* Match an assignment under the form:
42 (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
43 ! evolution_of_loop, limit);
46 *evolution_of_loop = add_to_evolution
48 ! chrec_convert (type_rhs, *evolution_of_loop, at_stmt),
51 else if (res == t_false)
54 /* Match an assignment under the form:
56 + evol = *evolution_of_loop;
58 (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
62 *evolution_of_loop = add_to_evolution
64 ! chrec_convert (type_rhs, evol, at_stmt),
67 else if (res == t_false)