[AliasAnalysis] Why do we not use EarliestEscapeInfo in multiple passes?

I see that similar to SimpleCaptureInfo, we have EarliestEscapeInfo available in AliasAnalysis which has some flow-sensitive functionalities. But I can only see its being used in DSE and no other places. Is there any reason why we do not use it anywhere else? The function isNotCapturedBeforeOrAt can help us in situations like the following simple snippet:

define void @caller_a(ptr %indirect_a0) {
  %escape_alloca_a0 = alloca double

  %loaded_a0 = load ptr, ptr %indirect_a0

  call void @callee(ptr %escape_alloca_a0)

Alias Analysis still returns MayAlias for the pair %escape_alloca_a0 and %loaded_a0 even though %escape_alloca_a0 is escaped after the load (please correct me if I’m wrong). As far as I understand, other passes like LICM, GVN, AA, Store forwarding, etc to name a few can benefit from this.


EarliestEscapeInfo is more expensive than SimpleCaptureInfo, so we only use it if we can effectively cache it. DSE uses a single BatchAA instance with a single EarliestEscapeInfo instance for the entire pass.

There are probably more places where it can be used with a careful review of required invalidation, but nobody has done the work for this yet.

Got it, Thanks!