aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index b138caa..61c992d 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1337,8 +1337,8 @@ static void computeKnownBitsFromOperator(const Operator *I,
AccConstIndices += IndexConst.sextOrTrunc(BitWidth);
continue;
} else {
- ScalingFactor.Zero = ~TypeSizeInBytes;
- ScalingFactor.One = TypeSizeInBytes;
+ ScalingFactor =
+ KnownBits::makeConstant(APInt(IndexBitWidth, TypeSizeInBytes));
}
IndexBits = KnownBits::computeForMul(IndexBits, ScalingFactor);
@@ -1353,9 +1353,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
/*Add=*/true, /*NSW=*/false, Known, IndexBits);
}
if (!Known.isUnknown() && !AccConstIndices.isNullValue()) {
- KnownBits Index(BitWidth);
- Index.Zero = ~AccConstIndices;
- Index.One = AccConstIndices;
+ KnownBits Index = KnownBits::makeConstant(AccConstIndices);
Known = KnownBits::computeForAddSub(
/*Add=*/true, /*NSW=*/false, Known, Index);
}
@@ -1818,8 +1816,7 @@ void computeKnownBits(const Value *V, const APInt &DemandedElts,
const APInt *C;
if (match(V, m_APInt(C))) {
// We know all of the bits for a scalar constant or a splat vector constant!
- Known.One = *C;
- Known.Zero = ~Known.One;
+ Known = KnownBits::makeConstant(*C);
return;
}
// Null and aggregate-zero are all-zeros.