[llvm] r300307 - [ValueTracking] Use APInt::sext instead of zext and setBitsFrom. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 23:43:29 PDT 2017


Author: ctopper
Date: Fri Apr 14 01:43:29 2017
New Revision: 300307

URL: http://llvm.org/viewvc/llvm-project?rev=300307&view=rev
Log:
[ValueTracking] Use APInt::sext instead of zext and setBitsFrom. NFC

Modified:
    llvm/trunk/lib/Analysis/ValueTracking.cpp

Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=300307&r1=300306&r2=300307&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri Apr 14 01:43:29 2017
@@ -1078,15 +1078,10 @@ static void computeKnownBitsFromOperator
     KnownZero = KnownZero.trunc(SrcBitWidth);
     KnownOne = KnownOne.trunc(SrcBitWidth);
     computeKnownBits(I->getOperand(0), KnownZero, KnownOne, Depth + 1, Q);
-    KnownZero = KnownZero.zext(BitWidth);
-    KnownOne = KnownOne.zext(BitWidth);
-
     // If the sign bit of the input is known set or clear, then we know the
     // top bits of the result.
-    if (KnownZero[SrcBitWidth-1])             // Input sign bit known zero
-      KnownZero.setBitsFrom(SrcBitWidth);
-    else if (KnownOne[SrcBitWidth-1])           // Input sign bit known set
-      KnownOne.setBitsFrom(SrcBitWidth);
+    KnownZero = KnownZero.sext(BitWidth);
+    KnownOne = KnownOne.sext(BitWidth);
     break;
   }
   case Instruction::Shl: {




More information about the llvm-commits mailing list