[llvm-dev] AA pass dependencies

Markus Lavin via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 2 01:34:12 PST 2019


To be more specific I am trying to use LVI from inside BasicAA to improve some cases that turned out to be relevant for our downstream target.

The code is in https://reviews.llvm.org/D55107 and I have problems with a failing assert in the LazyValueInfoWrapperPass destructor caused by the fact that LVI is accessed (via BasicAA) after it has been freed. This in turn seem to be because BasicAA is accessed after it has been freed and this brings us to the original question i.e.

Why is it that 'Basic Alias Analysis (stateless AA impl)' is freed much earlier than 'Function Alias Analysis Results' even though the latter depends on the former (at least AFAICT by looking at lib/Analysis/AliasAnalysis.cpp)?

As far as I can tell later passes such as scheduling typically depend on AAResultsWrapperPass which in turn depend on BasicAAWrapperPass (which in my case also depend on LazyValueInfoWrapperPass). When scheduling needs to query aliasing it uses its AAResults handle but this may then use its BasicAA handle which may use its LVI handle and now the problem is that according to -debug-pass=Executions the latter two have been freed. For BasicAA itself this seem to be no major issue but for LVI it causes the failed assertion as any call into it will allocate its internal implementation but when there is no following releaseMemory called during free the assertion will fail when it is finally to be destructed.

Perhaps I have grossly misunderstood how these analysis pass dependencies are supposed to work but either way I do find it highly confusing indeed :)

Thanks!
-Markus

From: Chandler Carruth <chandlerc at gmail.com>
Sent: Tuesday, January 1, 2019 12:06 AM
To: Markus Lavin <markus.lavin at ericsson.com>
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] AA pass dependencies

The management of passes in the legacy PM is ... highly confusing.

Do you have a specific problem you're trying to solve or a specific question?

On Thu, Dec 27, 2018 at 6:47 AM Markus Lavin via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:

Hi,



Looking at the output of e.g.



llc -mtriple=x86_64-unknown-linux-gnu test/CodeGen/X86/pre-coalesce.ll -debug-pass=Executions



Why is it that 'Basic Alias Analysis (stateless AA impl)' is freed much earlier than 'Function Alias Analysis Results' even though the latter depends on the former (at least AFAICT by looking at lib/Analysis/AliasAnalysis.cpp)?



Thanks!

-Markus
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190102/f844d865/attachment.html>


More information about the llvm-dev mailing list