[PATCH] D4609: Top-Down FunctionAttrs propagation for noalias, dereferenceable and nonnull inference

Haicheng Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 17 09:03:38 PST 2017


haicheng added a comment.

> It occurs to me that the need for this might be removed by another potential improvement (suggested to me by Chandler at EuroLLVM this year): We can make CGSCC analysis wrapper for our current analysis passes in order to allow these analyses to look back through function arguments into the function's callers. To make this work, we'd:
> 
> 1. Make CGSCC analysis passes corresponding to our current analysis passes. For example, AA, ValueTracking, etc. (I realize that ValueTracking is not really an analysis pass right now, and while we might want to change that at some point, I don't think it matters for this description).
> 2. These pass accept analysis queries and produce results by looking at the calling functions and calling the function/local analysis on the values at each call site, and then intersecting the results. If there are too many call sites, or unknown call sites, then you need to give up.
> 3. Provide these CGSCC analysis handles to the corresponding local analyses so that, as they do a recursive analysis, when they hit arguments, then can call into the CGSCC analyses to continue the analysis into the callers.
> 
>   If we did  that, do you think we'd still need this transformation?

Hi Hal,

I spent some time thinking about the alternative method you mentioned here.  I think the  alternative can cover many cases that this patch tries to solve, but this patch still could bring some additional advantages.

1. The new pass provides a place dedicated to do the Top-Down propagation.  It is simpler and easy to maintain.  We can add more attributes to propagate in the future.
2. Not only the direct users of AA or value tracking can get benefits from this patch, any pass runs after this new pass can easily get access to the propagated attributes.
3. The alternative one has a long way to go, but your patch is almost there.  I spend some time fixing the bugs and it is working for most of cases now.

I am thinking maybe the two methods can co-exist.  This patch can cut the number of recursive calls and together they can cover more cases.  Do you think it is worthwhile if I continue working on this patch?


https://reviews.llvm.org/D4609





More information about the llvm-commits mailing list