[llvm-dev] Existing studies on the benefits of pointer analysis

Chris Lattner via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 29 17:52:04 PDT 2016


> On Mar 28, 2016, at 8:26 AM, Daniel Berlin <dberlin at dberlin.org> wrote:
> 
>> 
> For the example to work here the CSE pass itself needs to be flow-sensitive and context-sensitive. I don't think that's how most optimizations in LLVM work. If it is, then I agree with all you said. But if it isn't, there's no point in bumping up the context sensitivity just for the pointer analysis.
> 
> As Daniel mentioned earlier in this thread, the analysis analysis framework in LLVM doesn't provide any APIs for flow-sensitive queries as well as context-sensitive queries. This design choice almost eliminate any possibilities for a flow-sensitive or context-sensitive pointer analysis to be useful. Strangely, the set of APIs does support 1-CFA context-sensitive mod-ref queries (so I guess one could somehow reap some context-sensitive benefits out of them after all). To me that design incoherence looks confusing, but I'm pretty sure you know much better than me why it should work that way :)
>  
> In general, I would never assume someone sat down and thought *really hard* about the design of an API in a piece of software to get it right for all time. It happens, but it's actually pretty rare.  One of the most limited resources most software teams have is time, and they use often use that time to get done what they need, and design APIs based on current and easily predictable future needs.
> 
> The same thing is true about LLVM's APIs.  You shouldn't assume we sat down, thought really hard about AA by meditating upon a mountain, and then designed this API.  Instead, some thought was put into it, based on current and easily predicted needs, and then people moved on.
> 
> I can't say this was the wrong choice, either, given how long it has been since someone has even come along considering implementing context sensitive or flow-sensitive AA (and having talked to tons of people over the years, this is *not* a chicken and egg problem. Literally nobody has had a *strong* desire). It wouldn't make much sense to try to design an API without any implementations that want to use those API's.
> 
> As that changes, i expect the AA API will be redesigned and reworked to accomodate the needs of those things.

FWIW, DS-AA is context sensitive in this way, and LLVM definitely does take advantage of it.  Even circa 2005. This is the whole point of chapter 4 of http://llvm.org/pubs/2005-05-04-LattnerPHDThesis.html 

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160329/681843df/attachment.html>


More information about the llvm-dev mailing list