[PATCH] Infer known bits from dominating conditions

Philip Reames listmail at philipreames.com
Wed May 13 16:11:17 PDT 2015


Sorry for taking so long to get back to you.  This has been put on the 
back burner for the moment.

To answer your question, I don't believe this line of work will help 
you.  KnownBits would need to infer that some specific bit is non-zero 
to prove that the value in question is non-zero.  Unless I'm misreading 
your example, you don't know this.  You really want something more along 
the lines of a constant range analysis pass. We have something like that 
in LVI today, but I've given absolutely no thought to how to use that in 
alias analysis.  Daniel's concerns seem entirely reasonable to me and I 
suspect would be prohibitive of any attempt before the pass manager has 
been *finally* finished. (Feel free to go bug/harass Chandler!)

To give a quick update on this line of work as a whole:
- Nick was able to run some internal tests for me.  His overall results 
showed that a) compile time wasn't too badly impacted (2-3% on average), 
but b) lots of bugs were exposed by enabling this.  I haven't had a 
chance to go stomp all those bugs and would definitely welcome help here.
- I need to get around to implementing a couple of known performance 
tweaks and completing the branch checking.  Currently the code is 
somewhat incomplete (but functional.)
- I plan to pursue turning this on by default once the previous two 
issues are addressed.
- I've also been looking in to other approaches for solving the same 
issues.  I see no reason to only solve this one way and have been trying 
to get some of the easy cases dealt with.  Examples include: 
http://reviews.llvm.org/D9312, http://reviews.llvm.org/D9763, 
https://llvm.org/bugs/show_bug.cgi?id=23333.

Philip

On 03/30/2015 08:48 AM, James Molloy wrote:
> Hi Philip,
>
> Slightly late to the party here, but I think this work might help fix 
> PR23067.
>
> In PR23067, BasicAA needs to know if a value is known non-zero or not. 
> In the example code, the value is known non-zero by virtue of the 
> dominating condition. However, IsKnownNonZero just calls 
> calculateKnownBits. Your dominance stuff will be able to know that all 
> bits cannot be zero, but that information is lost because any bit 
> could be set or unset.
>
> Is there a plan, or what would be the easiest way, of extending your 
> change so that isKnownNonZero would get the right information from a 
> dominating condition?
>
> Cheers,
>
> James
>
> On Tue, 10 Mar 2015 at 23:17 Philip Reames <listmail at philipreames.com 
> <mailto:listmail at philipreames.com>> wrote:
>
>     REPOSITORY
>       rL LLVM
>
>     http://reviews.llvm.org/D7708
>
>     Files:
>       llvm/trunk/lib/Analysis/ValueTracking.cpp
>       llvm/trunk/test/Transforms/InstCombine/dom-conditions.ll
>
>     EMAIL PREFERENCES
>     http://reviews.llvm.org/settings/panel/emailpreferences/
>     _______________________________________________
>     llvm-commits mailing list
>     llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150513/4aa646e6/attachment.html>


More information about the llvm-commits mailing list