https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121035
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- OK, so the issue is that during VN we do Value numbering stmt = _1 = c; Setting value number of _1 to g_15 (changed) g_15 is available for g_15 Value numbering stmt = _2 = _1 << 1; g_15 is available for g_15 g_15 is available for g_15 Inserting name _24 for expression g_15 * 2 Setting value number of _2 to _24 (changed) ... Value numbering stmt = _1 = c; Setting value number of _1 to _1 (changed) Making available beyond BB5 _1 for value _1 Value numbering stmt = _2 = _1 << 1; Inserting name _21 for expression _1 * 2 Setting value number of _2 to _21 (changed) and the earlier inserted expression, g_15 * 2, is still in the VN tables with the valnum _24. That gets picked up during PRE simplification but it has no reference from the stmts, so AVAIL computation does not add any expression to its value. It's reasonably easy to avoid the ICE, but this might be a missed optimization in the end I think.