summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-21 16:43:32 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-21 16:43:32 +0000
commit72f31a8381d023a765b3c4ba96da217cdd233ba9 (patch)
tree7425fee41121e174503dadc037670d8956bd2c8a /llvm/lib/Analysis/ValueTracking.cpp
parent1dc8fc8bfae61bf06b335ab75b79185e07e6a87b (diff)
downloadbcm5719-llvm-72f31a8381d023a765b3c4ba96da217cdd233ba9.tar.gz
bcm5719-llvm-72f31a8381d023a765b3c4ba96da217cdd233ba9.zip
[ValueTracking] Use APInt::setAllBits and APInt::intersects to simplify some code. NFC
llvm-svn: 300997
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 900a2363e60..e2ffa440c90 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -778,7 +778,7 @@ static void computeKnownBitsFromAssume(const Value *V, APInt &KnownZero,
// so this isn't a real bug. On the other hand, the program may have undefined
// behavior, or we might have a bug in the compiler. We can't assert/crash, so
// clear out the known bits, try to warn the user, and hope for the best.
- if ((KnownZero & KnownOne) != 0) {
+ if (KnownZero.intersects(KnownOne)) {
KnownZero.clearAllBits();
KnownOne.clearAllBits();
@@ -860,7 +860,8 @@ static void computeKnownBitsFromShiftOperator(
computeKnownBits(I->getOperand(0), KnownZero2, KnownOne2, Depth + 1, Q);
- KnownZero = KnownOne = APInt::getAllOnesValue(BitWidth);
+ KnownZero.setAllBits();
+ KnownOne.setAllBits();
for (unsigned ShiftAmt = 0; ShiftAmt < BitWidth; ++ShiftAmt) {
// Combine the shifted known input bits only for those shift amounts
// compatible with its known constraints.
@@ -888,7 +889,7 @@ static void computeKnownBitsFromShiftOperator(
// return anything we'd like, but we need to make sure the sets of known bits
// stay disjoint (it should be better for some other code to actually
// propagate the undef than to pick a value here using known bits).
- if ((KnownZero & KnownOne) != 0) {
+ if (KnownZero.intersects(KnownOne)) {
KnownZero.clearAllBits();
KnownOne.clearAllBits();
}
OpenPOWER on IntegriCloud