Do not compute 1ULL << 64, which is undefined. This fixes Ptrdist/ks on the
authorChris Lattner <sabre@nondot.org>
Fri, 4 Mar 2005 23:21:33 +0000 (23:21 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 4 Mar 2005 23:21:33 +0000 (23:21 +0000)
sparc, and testcase Regression/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20445 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index a90dde6c8aadca9ec47e09e9e2ffeb659d86b9d3..e944672d262894e87ea7da561aaa6af283d4b3d2 100644 (file)
@@ -2563,7 +2563,8 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) {
               Constant *Mask;
               if (CI->getType()->isUnsigned()) {
                 unsigned TypeBits = CI->getType()->getPrimitiveSize()*8;
-                Val &= (1ULL << TypeBits)-1;
+                if (TypeBits != 64)
+                  Val &= (1ULL << TypeBits)-1;
                 Mask = ConstantUInt::get(CI->getType(), Val);
               } else {
                 Mask = ConstantSInt::get(CI->getType(), Val);