https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94045
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/alias.c.jj 2020-03-03 19:39:53.228598307 +0100 +++ gcc/alias.c 2020-03-05 13:32:10.115235397 +0100 @@ -2005,6 +2005,10 @@ find_base_term (rtx x, vec<std::pair<cse if (cselib_sp_based_value_p (val)) return static_reg_base_value[STACK_POINTER_REGNUM]; + if (visited_vals.length () > 2048 + && cselib_preserved_value_p (val)) + return ret; + f = val->locs; /* Reset val->locs to avoid infinite recursion. */ if (f) works the same on the testcase, and doesn't affect non-var-tracking.