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 | 4be6ae4e6cb3d123cecc10c4f4e935a64c15816d (patch) | |
tree | ad78bcf4587b09ca6c4259d50cff2ff5dadcb2ca /llvm/lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | fb4191cc04472955f05e1ada62aa34724c52b7b2 (diff) | |
download | bcm5719-llvm-4be6ae4e6cb3d123cecc10c4f4e935a64c15816d.tar.gz bcm5719-llvm-4be6ae4e6cb3d123cecc10c4f4e935a64c15816d.zip |
Fix an overaggressive SimplifyDemandedBits optimization on urem. This
fixes the 254.gap regression on x86 and the 403.gcc regression on x86-64.
llvm-svn: 50537
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 507e6f2a854..ce052f724e8 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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; |