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.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index a7aee65..8568a23 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1223,10 +1223,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
case Instruction::Shl: {
bool NSW = Q.IIQ.hasNoSignedWrap(cast<OverflowingBinaryOperator>(I));
auto KF = [NSW](const KnownBits &KnownShiftVal, unsigned ShiftAmt) {
- APInt ShiftAmtV(KnownShiftVal.getBitWidth(), ShiftAmt);
- KnownBits KnownShiftAmt;
- KnownShiftAmt.One = ShiftAmtV;
- KnownShiftAmt.Zero = ~ShiftAmtV;
+ KnownBits KnownShiftAmt = KnownBits::makeConstant(APInt(32, ShiftAmt));
KnownBits Result = KnownBits::shl(KnownShiftVal, KnownShiftAmt);
// If this shift has "nsw" keyword, then the result is either a poison
// value or has the same sign bit as the first operand.
@@ -1244,10 +1241,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
}
case Instruction::LShr: {
auto KF = [](const KnownBits &KnownShiftVal, unsigned ShiftAmt) {
- APInt ShiftAmtV(KnownShiftVal.getBitWidth(), ShiftAmt);
- KnownBits KnownShiftAmt;
- KnownShiftAmt.One = ShiftAmtV;
- KnownShiftAmt.Zero = ~ShiftAmtV;
+ KnownBits KnownShiftAmt = KnownBits::makeConstant(APInt(32, ShiftAmt));
return KnownBits::lshr(KnownShiftVal, KnownShiftAmt);
};
computeKnownBitsFromShiftOperator(I, DemandedElts, Known, Known2, Depth, Q,
@@ -1256,10 +1250,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
}
case Instruction::AShr: {
auto KF = [](const KnownBits &KnownShiftVal, unsigned ShiftAmt) {
- APInt ShiftAmtV(KnownShiftVal.getBitWidth(), ShiftAmt);
- KnownBits KnownShiftAmt;
- KnownShiftAmt.One = ShiftAmtV;
- KnownShiftAmt.Zero = ~ShiftAmtV;
+ KnownBits KnownShiftAmt = KnownBits::makeConstant(APInt(32, ShiftAmt));
return KnownBits::ashr(KnownShiftVal, KnownShiftAmt);
};
computeKnownBitsFromShiftOperator(I, DemandedElts, Known, Known2, Depth, Q,