diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-11-01 13:16:48 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-11-01 13:16:48 +0000 |
commit | 687982c181912ce7970fe526ae0e8dd5a9b4d28a (patch) | |
tree | ce2f5f53415c3a48bbd8f8dab878aa0d6c8d0a4f /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | f657ba0cb62f939d8964dccb5d0d745a2e05e7bc (diff) | |
download | bcm5719-llvm-687982c181912ce7970fe526ae0e8dd5a9b4d28a.tar.gz bcm5719-llvm-687982c181912ce7970fe526ae0e8dd5a9b4d28a.zip |
[SelectionDAG] computeKnownBits - use ashrInPlace on known bits of ISD::SRA input. NFCI.
llvm-svn: 317087
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 5a9e798958a..e5de280508b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2479,17 +2479,9 @@ void SelectionDAG::computeKnownBits(SDValue Op, KnownBits &Known, case ISD::SRA: if (const APInt *ShAmt = getValidShiftAmountConstant(Op)) { computeKnownBits(Op.getOperand(0), Known, DemandedElts, Depth + 1); - Known.Zero.lshrInPlace(*ShAmt); - Known.One.lshrInPlace(*ShAmt); - // If we know the value of the sign bit, then we know it is copied across - // the high bits by the shift amount. - APInt SignMask = APInt::getSignMask(BitWidth); - SignMask.lshrInPlace(*ShAmt); // Adjust to where it is now in the mask. - if (Known.Zero.intersects(SignMask)) { - Known.Zero.setHighBits(ShAmt->getZExtValue());// New bits are known zero. - } else if (Known.One.intersects(SignMask)) { - Known.One.setHighBits(ShAmt->getZExtValue()); // New bits are known one. - } + // Sign extend known zero/one bit (else is unknown). + Known.Zero.ashrInPlace(*ShAmt); + Known.One.ashrInPlace(*ShAmt); } break; case ISD::SIGN_EXTEND_INREG: { |