tree-optimization/87615 - VN predication is expensive
The following restricts the number of locations we register a predicate
as valid which avoids the expensive linear search for cases like
if (a)
A;
if (a)
B;
if (a)
C;
...
where we register a != 0 as true for locations A, B, C ... in an
unlimited way. The patch simply choses 8 as limit. The underlying
issue for this case is the data structure which does not allow for
easy "forgetting" or more optimal searching when locations become
no longer relevant (the whole point of the location list is to
represent where predicates are relevant).
The patch also splits the search/copy loop into two to avoid copying
stuff that we'll not need when finding an existing better entry or,
new now, when we figure we run over the limit.
PR tree-optimization/87615
* tree-ssa-sccvn.cc (vn_nary_op_insert_into): When inserting
a new predicate or location into an existing predicate list
make sure to not exceed 8 locations. Avoid copying things
when we later eventually throw them away.
(vn_nary_op_insert_pieces_predicated): Avoid expensive check
when not checking.
(dominated_by_p_w_unex): Apply the limit on a single successors
predecessor count consistently.