From d48653a3abc61bd4fcf0e539a37979dc412a2c16 Mon Sep 17 00:00:00 2001 From: Zhou Sheng Date: Thu, 29 Mar 2007 04:45:55 +0000 Subject: [PATCH] Clean up some codes in InstCombiner::SimplifyDemandedBits(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35446 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index a8a537353d0..038779da9e5 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1135,10 +1135,9 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask, uint32_t SrcBitWidth = SrcTy->getBitWidth(); DemandedMask &= SrcTy->getMask().zext(BitWidth); - uint32_t zextBf = SrcTy->getBitWidth(); - DemandedMask.trunc(zextBf); - RHSKnownZero.trunc(zextBf); - RHSKnownOne.trunc(zextBf); + DemandedMask.trunc(SrcBitWidth); + RHSKnownZero.trunc(SrcBitWidth); + RHSKnownOne.trunc(SrcBitWidth); if (SimplifyDemandedBits(I->getOperand(0), DemandedMask, RHSKnownZero, RHSKnownOne, Depth+1)) return true; @@ -1168,10 +1167,9 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask, if ((NewBits & DemandedMask) != 0) InputDemandedBits |= InSignBit; - uint32_t sextBf = SrcTy->getBitWidth(); - InputDemandedBits.trunc(sextBf); - RHSKnownZero.trunc(sextBf); - RHSKnownOne.trunc(sextBf); + InputDemandedBits.trunc(SrcBitWidth); + RHSKnownZero.trunc(SrcBitWidth); + RHSKnownOne.trunc(SrcBitWidth); if (SimplifyDemandedBits(I->getOperand(0), InputDemandedBits, RHSKnownZero, RHSKnownOne, Depth+1)) return true; @@ -1193,10 +1191,6 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask, return UpdateValueUsesWith(I, NewCast); } else if (RHSKnownOne[SrcBitWidth-1]) { // Input sign bit known set RHSKnownOne |= NewBits; - RHSKnownZero &= ~NewBits; - } else { // Input sign bit unknown - RHSKnownZero &= ~NewBits; - RHSKnownOne &= ~NewBits; } break; }