Skip to content

Commit

Permalink
Use !operator to test if APInt is zero/non-zero. NFCI.
Browse files Browse the repository at this point in the history
Avoids APInt construction and slower comparisons.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285822 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
RKSimon committed Nov 2, 2016
1 parent 8817e15 commit 6960085
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
APInt KnownZero2, KnownOne2;
unsigned NumElts = DemandedElts.getBitWidth();

if (DemandedElts == APInt(NumElts, 0))
if (!DemandedElts)
return; // No demanded elts, better to assume we don't know anything.

switch (Op.getOpcode()) {
Expand Down Expand Up @@ -2099,13 +2099,13 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
DemandedRHS.setBit((unsigned)M % NumElts);
}
// Known bits are the values that are shared by every demanded element.
if (DemandedLHS != APInt(NumElts, 0)) {
if (!!DemandedLHS) {
SDValue LHS = Op.getOperand(0);
computeKnownBits(LHS, KnownZero2, KnownOne2, DemandedLHS, Depth + 1);
KnownOne &= KnownOne2;
KnownZero &= KnownZero2;
}
if (DemandedRHS != APInt(NumElts, 0)) {
if (!!DemandedRHS) {
SDValue RHS = Op.getOperand(1);
computeKnownBits(RHS, KnownZero2, KnownOne2, DemandedRHS, Depth + 1);
KnownOne &= KnownOne2;
Expand Down

0 comments on commit 6960085

Please sign in to comment.