JumpThreading now preserves dominance and lazy value information across the entire pass. The pass manager is also informed of this preservation with the goal of DT and LVI being recalculated fewer times overall during compilation.
This change prepares JumpThreading for enhanced opportunities; particularly those across loop boundaries.
Patch by Brian Rzycki and Sebastian Pop.
This is the second attempt at the patch, the first one can be found at D37528. This also includes the fix from D38383 and a fix to an assert reported by @eli.friedman .
@eli.friedman This is the fix for your assert. In this context BB had a terminator instruction that looked like:
In this corner-case we don't actually remove the edge in the dominance graph because we're converting to:
And the edge between these two blocks still exists.