1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[SimplifyDemandedBits] Use APInt::intersects to instead of ANDing and comparing to 0 separately. NFC

llvm-svn: 372158
This commit is contained in:
Craig Topper 2019-09-17 18:19:02 +00:00
parent f3b3429a72
commit 848c5cfc3a

View File

@ -1285,7 +1285,7 @@ bool TargetLowering::SimplifyDemandedBits(
// out) are never demanded. // out) are never demanded.
// TODO - support non-uniform vector amounts. // TODO - support non-uniform vector amounts.
if (Op0.getOpcode() == ISD::SRL) { if (Op0.getOpcode() == ISD::SRL) {
if ((DemandedBits & APInt::getLowBitsSet(BitWidth, ShAmt)) == 0) { if (!DemandedBits.intersects(APInt::getLowBitsSet(BitWidth, ShAmt))) {
if (ConstantSDNode *SA2 = if (ConstantSDNode *SA2 =
isConstOrConstSplat(Op0.getOperand(1), DemandedElts)) { isConstOrConstSplat(Op0.getOperand(1), DemandedElts)) {
if (SA2->getAPIntValue().ult(BitWidth)) { if (SA2->getAPIntValue().ult(BitWidth)) {
@ -1392,7 +1392,8 @@ bool TargetLowering::SimplifyDemandedBits(
if (Op0.getOpcode() == ISD::SHL) { if (Op0.getOpcode() == ISD::SHL) {
if (ConstantSDNode *SA2 = if (ConstantSDNode *SA2 =
isConstOrConstSplat(Op0.getOperand(1), DemandedElts)) { isConstOrConstSplat(Op0.getOperand(1), DemandedElts)) {
if ((DemandedBits & APInt::getHighBitsSet(BitWidth, ShAmt)) == 0) { if (!DemandedBits.intersects(
APInt::getHighBitsSet(BitWidth, ShAmt))) {
if (SA2->getAPIntValue().ult(BitWidth)) { if (SA2->getAPIntValue().ult(BitWidth)) {
unsigned C1 = SA2->getZExtValue(); unsigned C1 = SA2->getZExtValue();
unsigned Opc = ISD::SRL; unsigned Opc = ISD::SRL;