https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124692
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- fold_stmt ends up walking SSA operands of the stmt - that's a bit corner-case, stmts may not be up-to-date (and that's what is happening here). It's only valid to follow SSA use->def chains, but range_of_expr will happily throw up full ranger eventually ending in niter code which walks such. Now, forwprop substitutes and then calls update_stmt before folding, so that is what I'm going to do for replace_uses_by.
