Skip to content

Commit

Permalink
Use setBits in SelectionDAG
Browse files Browse the repository at this point in the history
Summary: As per title.

Reviewers: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30836

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297559 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
deadalnix committed Mar 11, 2017
1 parent a8ffe4b commit ff2afbf
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2308,14 +2308,14 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
if (TLI->getBooleanContents(Op.getValueType().isVector(), false) ==
TargetLowering::ZeroOrOneBooleanContent &&
BitWidth > 1)
KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - 1);
KnownZero.setBitsFrom(1);
break;
case ISD::SETCC:
// If we know the result of a setcc has the top bits zero, use this info.
if (TLI->getBooleanContents(Op.getOperand(0).getValueType()) ==
TargetLowering::ZeroOrOneBooleanContent &&
BitWidth > 1)
KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - 1);
KnownZero.setBitsFrom(1);
break;
case ISD::SHL:
if (const APInt *ShAmt = getValidShiftAmountConstant(Op)) {
Expand All @@ -2324,7 +2324,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
KnownZero = KnownZero << *ShAmt;
KnownOne = KnownOne << *ShAmt;
// Low bits are known zero.
KnownZero |= APInt::getLowBitsSet(BitWidth, ShAmt->getZExtValue());
KnownZero.setLowBits(ShAmt->getZExtValue());
}
break;
case ISD::SRL:
Expand All @@ -2334,8 +2334,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
KnownZero = KnownZero.lshr(*ShAmt);
KnownOne = KnownOne.lshr(*ShAmt);
// High bits are known zero.
APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt->getZExtValue());
KnownZero |= HighBits;
KnownZero.setHighBits(ShAmt->getZExtValue());
}
break;
case ISD::SRA:
Expand Down Expand Up @@ -2498,7 +2497,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
if (TLI->getBooleanContents(Op.getOperand(0).getValueType()) ==
TargetLowering::ZeroOrOneBooleanContent &&
BitWidth > 1)
KnownZero.setBits(1, BitWidth);
KnownZero.setBitsFrom(1);
break;
}
LLVM_FALLTHROUGH;
Expand Down Expand Up @@ -2549,7 +2548,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
if (TLI->getBooleanContents(Op.getOperand(0).getValueType()) ==
TargetLowering::ZeroOrOneBooleanContent &&
BitWidth > 1)
KnownZero.setBits(1, BitWidth);
KnownZero.setBitsFrom(1);
break;
}
LLVM_FALLTHROUGH;
Expand Down Expand Up @@ -2749,7 +2748,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,

KnownZero &= KnownZero2;
KnownOne &= KnownOne2;
KnownZero |= APInt::getHighBitsSet(BitWidth, LeadZero);
KnownZero.setHighBits(LeadZero);
break;
}
case ISD::UMAX: {
Expand All @@ -2765,7 +2764,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,

KnownZero &= KnownZero2;
KnownOne &= KnownOne2;
KnownOne |= APInt::getHighBitsSet(BitWidth, LeadOne);
KnownOne.setHighBits(LeadOne);
break;
}
case ISD::SMIN:
Expand Down

0 comments on commit ff2afbf

Please sign in to comment.