Track which SCEVs are used as ExactNotTaken counts in BackedgeTakenInfo structures, so we can directly determine which loops need to be invalidated, rather than iterating over all BECounts.
This gives a small compile-time improvement on average (https://llvm-compile-time-tracker.com/compare.php?from=77dd579827f2e7574be4bbf3f94a48930e7b094f&to=72d45d2131f55751be7654e5d13115fe5b150dbb&stat=instructions), but the motivation here is more to ensure there are no degenerate cases, if the number of backedge taken counts is large.
Basic idea makes sense, but I really think the user tracking should be here. Much easier to tell for sure we caught everything.
For one thing, you don't appear to be tracking the constantmax information in your patch, and I think we do need to add that.