[PATCH] D30311: [ValueTracking] Don't do an unchecked shift in ComputeNumSignBits

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 14:22:47 PST 2017


majnemer added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:2209
     if (match(U->getOperand(1), m_APInt(ShAmt))) {
-      Tmp += ShAmt->getZExtValue();
+      Tmp += ShAmt->getLimitedValue(TyBits);
       if (Tmp > TyBits) Tmp = TyBits;
----------------
Shouldn't we treat this in the same way we treat Instruction::Shl?


https://reviews.llvm.org/D30311





More information about the llvm-commits mailing list