MemDep: Invalidating NonLocal result cache entries?


MemDep caches results for local queries and provides means to
invalidate them by keeping reverse maps. Unfortunately, it also caches
results that represent non-local dependencies, for which there are no
reverse map entries, and thus those entries can not be invalidated.

This is a problem when an optimization turns a non-local dependency
into a local one. is an example for this.

One way to avoid this bug specifically is to mark MLSM as not
preserving MemDep. But a pass that both relies on MemDep and does
sinking like MLSM would be prone to hitting the same bug again,
without any means to avoid it. So I wonder what's the best approach

1) Mark MLSM as not preserving MemDep.
2) Don't cache NonLocal results.
3) Add a map to track which basic blocks have NonLocal results cached
and invalidate them when certain instructions are added to a basic


+ Gerolf