[AA] Move earliest escape tracking from DSE to AA
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 23 Sep 2021 19:23:17 +0000 (21:23 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 25 Sep 2021 20:40:41 +0000 (22:40 +0200)
commitba664d906644e62ac30e9a92edf48391c923992c
tree164dc5dfe399440d9ab480ddea239e6a2ae252ec
parent327bbbb10bfd95db38ae3406c87d481a07f67633
[AA] Move earliest escape tracking from DSE to AA

This is a followup to D109844 (and alternative to D109907), which
integrates the new "earliest escape" tracking into AliasAnalysis.
This is done by replacing the pre-existing context-free capture
cache in AAQueryInfo with a replaceable (virtual) object with two
implementations: The SimpleCaptureInfo implements the previous
behavior (check whether object is captured at all), while
EarliestEscapeInfo implements the new behavior from DSE.

This combines the "earliest escape" analysis with the full power of
BasicAA: It subsumes the call handling from D109907, considers a
wider range of escape sources, and works with AA recursion. The
compile-time cost is slightly higher than with D109907.

Differential Revision: https://reviews.llvm.org/D110368
llvm/include/llvm/Analysis/AliasAnalysis.h
llvm/lib/Analysis/AliasAnalysis.cpp
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/test/Transforms/DeadStoreElimination/captures-before-call.ll
llvm/test/Transforms/DeadStoreElimination/captures-before-load.ll
llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp