diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-05-30 15:00:45 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-05-30 15:00:45 +0000 |
commit | 6319c0c5203450e9d9a79cc6d57764b97d814da2 (patch) | |
tree | 85cd42525ea8cf34eab3fcc3ac6e31c95aaa750c /lib/CodeGen/SelectionDAG | |
parent | 3a45d4c62136a0eb7c433a0e6435e8734aa28333 (diff) | |
download | llvm-6319c0c5203450e9d9a79cc6d57764b97d814da2.tar.gz llvm-6319c0c5203450e9d9a79cc6d57764b97d814da2.tar.bz2 llvm-6319c0c5203450e9d9a79cc6d57764b97d814da2.tar.xz |
[pr19636] Fix known bit computation in urem instruction with power of two.
Patch by Andrey Kuharev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 51ae11dea2..65a3f0a94b 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2185,8 +2185,11 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero, const APInt &RA = Rem->getAPIntValue(); if (RA.isPowerOf2()) { APInt LowBits = (RA - 1); - KnownZero |= ~LowBits; - computeKnownBits(Op.getOperand(0), KnownZero, KnownOne,Depth+1); + computeKnownBits(Op.getOperand(0), KnownZero2, KnownOne2, Depth + 1); + + // The upper bits are all zero, the lower ones are unchanged. + KnownZero = KnownZero2 | ~LowBits; + KnownOne = KnownOne2 & LowBits; break; } } |