As mentioned at the MSSA roundtable, LICM spends a lot of time construction an AST, despite the caps already in place. This patch is a proposal on how to reduce the impact.
The idea here is pretty simple: We're only interested in must-alias mod sets of loop invariant pointers. As such, only populate the AST with loop-invariant loads and stores (anything else is definitely not promotable) and then discard any sets with alias with any of the remaining, definitely non-promotable accesses.
If we promoted something, check whether this has made some other accesses loop invariant and thus possible promotion candidates.
This has a large positive compile-time impact: https://llvm-compile-time-tracker.com/compare.php?from=d7186fe3710828fab03de69f78f01f001d70e1aa&to=264016756045aba11ae326bfab6a632bc5ef1855&stat=instructions We save ~2% geomean at `O3`, and lencod in particular saves 6%.
There is **no** impact on the number of promotions (`licm.NumPromoted`) in test-suite with this change.
However, while there is no practical impact on test-suite, we do see one difference in the 2011-04-06-PromoteResultOfPromotion.ll test: Previously it could happen that promotion of one set made the pointers in another loop invariant (though this wasn't guaranteed, it depends on the order of the alias sets). We no longer catch such cases, as the non-invariant accesses (at that time) have already been discarded.