https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88148

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the issue is that VN done after unrolling removes SSA defs that are still
referenced from loop->nb_iterations.  CFG cleanup makes sure to update
it when doing replace_uses_by (which is a quite expensive operation!).
VN doesn't do anything like that.  For regions, when we are in loop-closed SSA
form we would know which loops to eventually update.  When we are not
in loop-closed SSA the affected loops are all downstream ones (blowing
away the region-VN complexity guarantees).  niter "uses" do not count towards
SSA uses.

We cannot easily substitute into loop info during eliminate_cleanup since
we need to substitute available names.  We could in theory substitute into
loop info during the main VN walk where we perform region elimination
when we visit a loop header.  But we'd have to eliminate a GENERIC tree
here...  There is already a helper besides substitute_in_loop_info, namely
the specific simplify_replace_tree which we could outfit with a valueization
hook rather than a 1:1 name/value pair.

Let me see if I can cook up sth like that.

Reply via email to