https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116747
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the issue is that we somehow recognize two then_stores (OK) but also
two else_stores (not OK, there's just one store there). That is, the loop
/* Find pairs of stores with equal LHS. */
auto_vec<gimple *, 1> then_stores, else_stores;
FOR_EACH_VEC_ELT (then_datarefs, i, then_dr)
{
if (DR_IS_READ (then_dr))
continue;
then_store = DR_STMT (then_dr);
then_lhs = gimple_get_lhs (then_store);
if (then_lhs == NULL_TREE)
continue;
found = false;
FOR_EACH_VEC_ELT (else_datarefs, j, else_dr)
{
happily picks stmts from else_datarefs twice.
I'll note that we check dependences for all stores but limit ourselves with
param_max_stores_to_sink only with the candidates to sink which doesn't
avoid possible quadraticness nicely. Instead limiting the size of
then_datarefs/else_datarefs would be more appropriate.
Also we only need dependences of a subset of stmts (below the earliest
candidates found).