diff options
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 07113e18..632a5ea 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1327,29 +1327,11 @@ static void computeKnownBitsFromOperator(const Operator *I, Known.makeNonNegative(); break; - case Instruction::URem: { - if (ConstantInt *Rem = dyn_cast<ConstantInt>(I->getOperand(1))) { - const APInt &RA = Rem->getValue(); - if (RA.isPowerOf2()) { - APInt LowBits = (RA - 1); - computeKnownBits(I->getOperand(0), Known, Depth + 1, Q); - Known.Zero |= ~LowBits; - Known.One &= LowBits; - break; - } - } - - // Since the result is less than or equal to either operand, any leading - // zero bits in either operand must also exist in the result. + case Instruction::URem: computeKnownBits(I->getOperand(0), Known, Depth + 1, Q); computeKnownBits(I->getOperand(1), Known2, Depth + 1, Q); - - unsigned Leaders = - std::max(Known.countMinLeadingZeros(), Known2.countMinLeadingZeros()); - Known.resetAll(); - Known.Zero.setHighBits(Leaders); + Known = KnownBits::urem(Known, Known2); break; - } case Instruction::Alloca: Known.Zero.setLowBits(Log2(cast<AllocaInst>(I)->getAlign())); break; |