Skip to content

Commit

Permalink
[DAG] MaskedVectorIsZero - don't bother with (-1).isSubsetOf mask che…
Browse files Browse the repository at this point in the history
…ck. NFC.

Just use KnownBits::isZero() to ensure all the bits are known zero.
  • Loading branch information
RKSimon committed Jul 24, 2022
1 parent e82d49b commit 0708771
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Expand Up @@ -2529,8 +2529,7 @@ bool SelectionDAG::MaskedValueIsZero(SDValue V, const APInt &Mask,
/// DemandedElts. We use this predicate to simplify operations downstream.
bool SelectionDAG::MaskedVectorIsZero(SDValue V, const APInt &DemandedElts,
unsigned Depth /* = 0 */) const {
APInt Mask = APInt::getAllOnes(V.getScalarValueSizeInBits());
return Mask.isSubsetOf(computeKnownBits(V, DemandedElts, Depth).Zero);
return computeKnownBits(V, DemandedElts, Depth).isZero();
}

/// MaskedValueIsAllOnes - Return true if '(Op & Mask) == Mask'.
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Expand Up @@ -37522,8 +37522,8 @@ static bool matchBinaryShuffle(MVT MaskVT, ArrayRef<int> Mask,
break;
}
if (IsBlend) {
if (DAG.computeKnownBits(V1, DemandedZeroV1).isZero() &&
DAG.computeKnownBits(V2, DemandedZeroV2).isZero()) {
if (DAG.MaskedVectorIsZero(V1, DemandedZeroV1) &&
DAG.MaskedVectorIsZero(V2, DemandedZeroV2)) {
Shuffle = ISD::OR;
SrcVT = DstVT = MaskVT.changeTypeToInteger();
return true;
Expand Down Expand Up @@ -41191,7 +41191,7 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(
SDValue Src = Op.getOperand(0);
APInt DemandedUpperElts = DemandedElts;
DemandedUpperElts.clearLowBits(1);
if (TLO.DAG.computeKnownBits(Src, DemandedUpperElts, Depth + 1).isZero())
if (TLO.DAG.MaskedVectorIsZero(Src, DemandedUpperElts, Depth + 1))
return TLO.CombineTo(Op, Src);
break;
}
Expand Down

0 comments on commit 0708771

Please sign in to comment.