diff options
author | James Molloy <james.molloy@arm.com> | 2016-01-25 14:49:36 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2016-01-25 14:49:36 +0000 |
commit | 121de0bcfaf321bc39366cd7b2b31b80e2c157c6 (patch) | |
tree | a837a864fa1af22a05896ea8f95a8ae33edb4cc3 /llvm/lib/Analysis | |
parent | 1bd7f993fc1f6dda20bd39983d9bfc280459b3ef (diff) | |
download | bcm5719-llvm-121de0bcfaf321bc39366cd7b2b31b80e2c157c6.tar.gz bcm5719-llvm-121de0bcfaf321bc39366cd7b2b31b80e2c157c6.zip |
[DemandedBits] Fix computation of demanded bits for ICmps
The computation of ICmp demanded bits is independent of the individual operand being evaluated. We simply return a mask consisting of the minimum leading zeroes of both operands.
We were incorrectly passing "I" to ComputeKnownBits - this should be "UserI->getOperand(0)". In cases where we were evaluating the 1th operand, we were taking the minimum leading zeroes of it and itself.
This should fix PR26266.
llvm-svn: 258690
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/DemandedBits.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DemandedBits.cpp b/llvm/lib/Analysis/DemandedBits.cpp index 912c5ceb754..143d0b79f18 100644 --- a/llvm/lib/Analysis/DemandedBits.cpp +++ b/llvm/lib/Analysis/DemandedBits.cpp @@ -244,7 +244,7 @@ void DemandedBits::determineLiveOperandBits( break; case Instruction::ICmp: // Count the number of leading zeroes in each operand. - ComputeKnownBits(BitWidth, I, UserI->getOperand(1)); + ComputeKnownBits(BitWidth, UserI->getOperand(0), UserI->getOperand(1)); auto NumLeadingZeroes = std::min(KnownZero.countLeadingOnes(), KnownZero2.countLeadingOnes()); AB = ~APInt::getHighBitsSet(BitWidth, NumLeadingZeroes); |