[APInt] Use isSubsetOf, intersects, and bit counting methods to reduce temporary APInts

This patch uses various APInt methods to reduce temporary APInt creation.

This should be all of the unrelated cleanups that got buried in D32376(creating a KnownBits struct) as well as some pointed out by Simon during the review of that. Plus a few improvements to use counting instead of masking.

I've left out any places where we do something like (KnownZero & KnownOne) != 0 as I plan to add a helper method to KnownBits to ask that question and didn't want to thrash that code an additional time.

Differential Revision: https://reviews.llvm.org/D32495

llvm-svn: 301338
This commit is contained in:
Craig Topper
2017-04-25 17:46:30 +00:00
parent b3b3c29c87
commit f3dbd17d0a
6 changed files with 11 additions and 13 deletions

View File

@@ -331,8 +331,7 @@ bool Vectorizer::isConsecutiveAccess(Value *A, Value *B) {
APInt KnownZero(BitWidth, 0);
APInt KnownOne(BitWidth, 0);
computeKnownBits(OpA, KnownZero, KnownOne, DL, 0, nullptr, OpA, &DT);
KnownZero &= ~APInt::getHighBitsSet(BitWidth, 1);
if (KnownZero != 0)
if (KnownZero.countTrailingZeros() < (BitWidth - 1))
Safe = true;
}