This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/37221] Missed early loop-unroll optimization - causes 40% degradation on SPU
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Sep 2008 09:04:59 -0000
- Subject: [Bug middle-end/37221] Missed early loop-unroll optimization - causes 40% degradation on SPU
- References: <bug-37221-13884@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from rguenth at gcc dot gnu dot org 2008-09-02 09:04 -------
It looks like SCEV does not see that for
(number_of_iterations_in_loop
(analyze_scalar_evolution
(loop_nb = 4)
(scalar = j_3)
(get_scalar_evolution
(scalar = j_3)
(scalar_evolution = ))
(analyze_initial_condition
(loop_phi_node =
j_3 = PHI <j_26(4), j_31(7)>
)
(init_cond = j_26))
(analyze_evolution_in_loop
(loop_phi_node = j_3 = PHI <j_26(4), j_31(7)>
)
(add_to_evolution
(loop_nb = 4)
(chrec_before = j_26)
(to_add = 1)
(res = {j_26, +, 1}_4))
(evolution_function = {j_26, +, 1}_4))
(set_scalar_evolution
(scalar = j_3)
(scalar_evolution = {j_26, +, 1}_4))
)
j_26 is defined by
<bb 4>:
# j_26 = PHI <0(3), 0(5), 0(12), 0(6)>
so it is all zeros. This is because the "iterative" unrolling only does
a cfg cleanup between iterations and not a full constant-prop.
We can "fix" this special case in analyze_initial_condition, but a real
fix would be to run a (partial) CCP pass after each set of unrolling.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37221