Adding contained caching to BasicAA and potential other AAs as wellAliasAnalysis. BasicAA is currently the only one using it.
- This patch is pulling the caches from BasicAAResults to AAResults, meaning the getModRefInfo call benefits from the IsCapturedCache as well when in "batch mode".
[DO NOT MERGE]- All AAResultBase implementations add the QueryInfo member to all APIs. AAResults APIs maintain wrapper APIs such that all alias()/getModRefInfo call sites are unchanged.
- AA now provides a BatchAAResults type as a wrapper to AAResults. It keeps the AAResults instance and a QueryInfo instantiated to batch mode. It delegates all work to the AAResults instance with the batched QueryInfo. More API wrappers may be needed in BatchAAResults; only the minimum needed is currently added.
Advantage over the first prototype is pulling the caches inside BasicAA::alias to AA results,MemorySSA changes:
- All walkers are now templated on the AA used (AliasAnalysis=AAResults or BatchAAResults).
- At build time, we optimize uses; meaning the getModRefInfo call benefits from the IsCapturedCache as well when in "batch mode".
All AAResultBase implementations add the QueryInfo member to all APIsnow we create a local walker (lives only as long as OptimizeUses does) using BatchAAResults.
- All Walkers have an internal AA and only use that now, never the AA in MemorySSA. AAResults APIs maintain wrapper APIs such that all alias()/getModRefInfo call sites are unchangedThe Walkers receive the AA they will use when built.
All users of AA rely on the AliasAnalysis type, a typedef of AAResults. Introducing a BatchAAResults type would need to be interchangable with AAResults (a new class wrapping either a SingleAAResults or BatchAAResults, or both types implementing the same interface.- The walker we use for queries after the build is instantiated on AliasAnalysis and can be built when building MemorySSA or not (commented out currently).
Current patch updates the AAResults instance in place,- All static methods doing walking are now templated on AliasAnalysisType if they are used both during build and after. If used only during build, the method now only takes a BatchAAResults. setting it in batch modeIf used only after build, or "out of" batch mode.the method now takes an AliasAnalysis.
Having temporary instances of some BatchAAResults will need to also account for users storing that temporary. The ClobberWalker currently stores a reference to AA when MemorySSA is built, so using a temporary AA and replacing it after the build, will need to also update the reference in the walker.
(see comment in MemorySSA.cpp)