------- Comment #12 from rguenth at gcc dot gnu dot org 2010-02-13 12:18
-------
Yep.
Index: tree-ssa-dom.c
===================================================================
--- tree-ssa-dom.c (revision 156666)
+++ tree-ssa-dom.c (working copy)
@@ -1455,8 +1455,7 @@ cprop_into_successor_phis (basic_block b
new_val = SSA_NAME_VALUE (orig_val);
if (new_val
&& new_val != orig_val
- && (TREE_CODE (new_val) == SSA_NAME
- || is_gimple_min_invariant (new_val))
+ && TREE_CODE (new_val) == SSA_NAME
&& may_propagate_copy (orig_val, new_val))
propagate_value (orig_p, new_val);
}
with that we end up with
g (int n, int i)
{
int s;
<bb 2>:
s_3 = 0;
if (n_5(D) > 0)
goto <bb 3>;
else
goto <bb 5>;
<bb 3>:
i_4 = 0;
<bb 4>:
# i_12 = PHI <i_7(4), i_4(3)>
# s_13 = PHI <s_6(4), s_3(3)>
s_6 = s_13 + i_12;
i_7 = i_12 + 1;
if (i_7 != n_5(D))
goto <bb 4>;
else
goto <bb 5>;
<bb 5>:
# s_9 = PHI <s_6(4), s_3(2)>
return s_9;
}
tree-ssa-sink sunk i_4 = 0 from bb2 to bb3.
Note that this shows that we may have extra BBs without constants in
PHI nodes.
But if it is more sane to not allow this we can experiment with this
for 4.6 quite easily.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42839