[PATCH] D94363: [AA] Pass AAResults through AAQueryInfo

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 9 13:14:06 PST 2021


nikic created this revision.
nikic added reviewers: asbirlea, jdoerfert.
Herald added subscribers: hiraditya, kristof.beyls.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently, AAResultBase (from which alias analysis passes inherit) stores a reference back to the AAResults aggregation it is part of, so it can perform recursive alias analysis queries via getBestAAResults. This has the implicit assumption that an AAResult can only be part of a single AAResults aggregation. At least under the legacy pass manager, this doesn't seem to actually be the case. This appears to be mostly harmless in practice, but caused quite a bit of confusion for me, and could be dangerous depending on the lifetimes of the objects involved (one could be left with dangling AAResults references).

Instead of storing a reference inside AAResult, this instead passes in the used AAResults aggregation as part of the query. AAQueryInfo offers a convenient way to do this nowadays. Code doing recursive queries just needs to use `AAQI.AAR` instead of `getBestAAResults()`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94363

Files:
  llvm/include/llvm/Analysis/AliasAnalysis.h
  llvm/lib/Analysis/AliasAnalysis.cpp
  llvm/lib/Analysis/BasicAliasAnalysis.cpp
  llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94363.315629.patch
Type: text/x-patch
Size: 14880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210109/ec55995e/attachment.bin>


More information about the llvm-commits mailing list