Hello,<div><br></div><div>This patch adds what seems to me to be a very efficient merge operation for LiveInterval to address the quadratic behavior seen in PR12652 when merging extremely large, extremely distant disjoint intervals created by ASan's strange code layout.</div>
<div><br></div><div>There is one other user of addRangeFrom left (join) and I think I can refactor this code a bit and share the merge logic for that routine as well. But I didn't want to do that in this patch.</div><div>
<br></div><div>With this patch, the previously dominant entry on the profile (extendIntervalEndTo) disappears *completely* from the test case in the PR. I dunno how far down it is, but it's no longer significant. None of the merge logic appears to be significant. Instead overlaysFrom and findLocalKills start to dominate the profile.</div>
<div><br></div><div>The performance which was previously quadratic is now roughly linear, but it's a rather unfortunate linear: 2x. Every doubling of the input size quadruples the compile time. Not sure how much time its worth driving this down versus teaching ASan to emit its basic blocks in a natural CFG order.</div>
<div><br></div><div>Comments welcome on the patch. One awkward aspect is that its interface is very ad-hoc. It happens to accept the parameterization required by the various merge-like behaviors in LiveInterval. This will get slightly worse if I add support for join as well.</div>
<div><br></div><div>-Chandler</div>