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 | 92945eee80d8d39a18b4033f7d589c92e6f50f39 (patch) | |
tree | a6c3f1c75a9c454802b9991440ea184e9c63b01b /llvm/lib/CodeGen | |
parent | d622e1282ce76c70c72c4b7272fcaa6e79e2a7bf (diff) | |
download | bcm5719-llvm-92945eee80d8d39a18b4033f7d589c92e6f50f39.tar.gz bcm5719-llvm-92945eee80d8d39a18b4033f7d589c92e6f50f39.zip |
[pr19636] Fix known bit computation in urem instruction with power of two.
Patch by Andrey Kuharev.
llvm-svn: 209902
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 51ae11dea21..65a3f0a94b1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/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; } } |