[PATCH] D27205: [PM] Teach the AAManager and AAResults layer (the worst offender for inter-analysis dependencies) to use the new invalidation infrastructure.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 05:14:27 PST 2016


chandlerc created this revision.
chandlerc added reviewers: jlebar, silvas.
chandlerc added a subscriber: llvm-commits.
chandlerc added a dependency: D27198: [PM] Introduce the facilities for registering cross-IR-unit dependencies that require deferred invalidation..
Herald added subscribers: mcrosier, mehdi_amini.

This teaches it to invalidate itself when any of the peer function
AA results that it uses become invalid. We do this by just tracking the
originating IDs. I've kept it in a somewhat clunky API since some users
of AAResults are outside the new PM right now. We can clean this API up
if/when those users go away.

Secondly, it uses the registration on the outer analysis manager proxy
to trigger deferred invalidation when a module analysis result becomes
invalid.

I've included test cases that specifically try to trigger use-after-free
in both of these cases and they would crash or hang pretty horribly for
me even without ASan. Now they work nicely.

The "InvalidateAnalysis" utility pass required some tweaking to be
useful in this context and it still is pretty garbage. I'd like to
switch it back to the previous implementation and teach the explicit
invalidate method on the AnalysisManager to take care of correctly
triggering indirect invalidation, but I wanted to go ahead and send this
out so folks could see how all of this stuff works together in practice.
And, you know, that it does actually work. =]

Depends on https://reviews.llvm.org/D27198.


https://reviews.llvm.org/D27205

Files:
  include/llvm/Analysis/AliasAnalysis.h
  include/llvm/IR/PassManager.h
  lib/Analysis/AliasAnalysis.cpp
  test/Other/new-pass-manager.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27205.79546.patch
Type: text/x-patch
Size: 9994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161129/6785d476/attachment.bin>


More information about the llvm-commits mailing list