Current aliasing algorithm with AST traverses through all instructions in the loop
whenever it sees a load. However, the only instructions it really needs to check is
memory writing instructions. In this patch, we precompute a set of memory writers
and keep it up to date, avoiding redundant checks.
This patch is NFC for current default (zero) threshold and profitable when loop
has more than 1 load and total loop size is below limit. In current implementation,
it may cause redundant computations when loop exceeds the limit and this limit is
non-zero. Need to think how to tackle this.
This gives us up to 25% speedup on some extreme case in big loop with many loads
and few writing instructions.
Optional<DenseSet<Instruction *> > clang-format adds that space between > >?
It's consistent throughout, so I guess so...it just looks odd to me :-).