This changes getDomMemoryDef to check if a DomAccess is a valid
candidate for elimination before checking for reads. Before the change,
we were spending a lot of compile-time in checking for read accesses for
DomAccess that might not even be removable.
This patch flips the logic, so we skip DomAccesses if they cannot be
removed before checking all their uses. This is much more efficient in
practice.
It also adds a more aggressive limit for checking partially overlapping
stores. The main problem with overlapping stores is that we do not know
if they will lead to elimination until seeing all of them. This patch
limits adds a new limit for overlapping store candidates, which keeps
the number of modified overlapping stores roughly the same.
This is another substantial compile-time improvement (while also
increasing the number of stores eliminated). Geomean -O3 -0.67%,
ReleaseThinLTO -0.97%.
nit: flip naming. Argument to StartAccess and local var that gets modified in loop to Current. Seems easier to follow IMO and it's only 2 lines to update.