From acc59870f70454c368be1130e94505094c7241b9 Mon Sep 17 00:00:00 2001 From: Zhou Sheng Date: Thu, 8 Mar 2007 15:15:18 +0000 Subject: [PATCH] Fix a bug in function ComputeMaskedBits(). llvm-svn: 35027 --- lib/Transforms/Scalar/InstructionCombining.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 02336e59c4c..79ad33697c7 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -677,7 +677,7 @@ static void ComputeMaskedBits(Value *V, APInt Mask, APInt& KnownZero, const IntegerType *SrcTy = cast(I->getOperand(0)->getType()); APInt NewBits(APInt::getAllOnesValue(BitWidth).shl(SrcTy->getBitWidth())); - Mask &= SrcTy->getMask().zext(BitWidth); + Mask &= SrcTy->getMask().zextOrTrunc(BitWidth); ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1); assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); // The top bits are known to be zero. @@ -689,7 +689,7 @@ static void ComputeMaskedBits(Value *V, APInt Mask, APInt& KnownZero, const IntegerType *SrcTy = cast(I->getOperand(0)->getType()); APInt NewBits(APInt::getAllOnesValue(BitWidth).shl(SrcTy->getBitWidth())); - Mask &= SrcTy->getMask().zext(BitWidth); + Mask &= SrcTy->getMask().zextOrTrunc(BitWidth); ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1); assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");