[PATCH] D32508: [ValueTracking] Begin adding some useful methods to the proposed KnownBits struct

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 30 04:56:20 PDT 2017


RKSimon added a comment.

In https://reviews.llvm.org/D32508#740518, @craig.topper wrote:

> Maybe a better name for isComplete/getValue would be isConstant and getConstant?


Makes sense to me.



================
Comment at: include/llvm/Support/KnownBits.h:53
+    assert(isValid() && "KnownBits conflict!");
+    return Zero.countPopulation() + One.countPopulation() == getBitWidth();
+  }
----------------
craig.topper wrote:
> I'm slightly concerned that doing the population count in the single word APInt case on pre-Westmere CPUs(no harware popcnt) is worse than doing the OR and checking for all 1s. But in the multiword case the OR needs a temporary APInt so this may be better.
> 
> Considering adding something like isUnionFull to APInt to do the OR in place on each word without the allocation like intersects and isSubsetOf.
Happy to go with this for now. APInt::isUnionFull makes sense - it complements the existing intersection/subset tests - but that can be a future change.


https://reviews.llvm.org/D32508





More information about the llvm-commits mailing list