diff options
author | Dan Gohman <gohman@apple.com> | 2008-05-01 19:13:24 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-05-01 19:13:24 +0000 |
commit | 23ea06da71a484be01e5714f2e60a1de47593b7e (patch) | |
tree | 93f56bb371b8eb0ddd8591862723a38b444644c1 /lib/Transforms/Scalar | |
parent | 172679f8ce0d092c30047761b6d40bf6aecf0d38 (diff) | |
download | external_llvm-23ea06da71a484be01e5714f2e60a1de47593b7e.zip external_llvm-23ea06da71a484be01e5714f2e60a1de47593b7e.tar.gz external_llvm-23ea06da71a484be01e5714f2e60a1de47593b7e.tar.bz2 |
Fix an overaggressive SimplifyDemandedBits optimization on urem. This
fixes the 254.gap regression on x86 and the 403.gcc regression on x86-64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 507e6f2..ce052f7 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1762,11 +1762,12 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask, APInt KnownZero2(BitWidth, 0), KnownOne2(BitWidth, 0); APInt AllOnes = APInt::getAllOnesValue(BitWidth); - ComputeMaskedBits(I->getOperand(0), AllOnes, - KnownZero2, KnownOne2, Depth+1); + if (SimplifyDemandedBits(I->getOperand(0), AllOnes, + KnownZero2, KnownOne2, Depth+1)) + return true; + uint32_t Leaders = KnownZero2.countLeadingOnes(); - APInt HighZeros = APInt::getHighBitsSet(BitWidth, Leaders); - if (SimplifyDemandedBits(I->getOperand(1), ~HighZeros, + if (SimplifyDemandedBits(I->getOperand(1), AllOnes, KnownZero2, KnownOne2, Depth+1)) return true; |