Skip to content

Commit

Permalink
[DAG] Use DAGCombiner::SimplifyDemandedBits wrappers with default (al…
Browse files Browse the repository at this point in the history
…l) DemandedElts. NFC.

Don't call TLI.SimplifyDemandedVectorElts directly from every SimplifyDemandedBits call, use the more expressive wrappers instead first.

This reduces the number of places we call TLI.SimplifyDemandedVectorElts and CommitTargetLoweringOpt to make it easier to track.

Part of the work to process DAG nodes in topological order.
  • Loading branch information
RKSimon committed Feb 7, 2024
1 parent 7760006 commit 670c252
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,16 +334,11 @@ namespace {
}

bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits) {
TargetLowering::TargetLoweringOpt TLO(DAG, LegalTypes, LegalOperations);
KnownBits Known;
if (!TLI.SimplifyDemandedBits(Op, DemandedBits, Known, TLO, 0, false))
return false;

// Revisit the node.
AddToWorklist(Op.getNode());

CommitTargetLoweringOpt(TLO);
return true;
EVT VT = Op.getValueType();
APInt DemandedElts = VT.isFixedLengthVector()
? APInt::getAllOnes(VT.getVectorNumElements())
: APInt(1, 1);
return SimplifyDemandedBits(Op, DemandedBits, DemandedElts, false);
}

/// Check the specified vector node value to see if it can be simplified or
Expand Down

0 comments on commit 670c252

Please sign in to comment.