Skip to content

Commit 670c252

Browse files
committed
[DAG] Use DAGCombiner::SimplifyDemandedBits wrappers with default (all) 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.
1 parent 7760006 commit 670c252

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -334,16 +334,11 @@ namespace {
334334
}
335335

336336
bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits) {
337-
TargetLowering::TargetLoweringOpt TLO(DAG, LegalTypes, LegalOperations);
338-
KnownBits Known;
339-
if (!TLI.SimplifyDemandedBits(Op, DemandedBits, Known, TLO, 0, false))
340-
return false;
341-
342-
// Revisit the node.
343-
AddToWorklist(Op.getNode());
344-
345-
CommitTargetLoweringOpt(TLO);
346-
return true;
337+
EVT VT = Op.getValueType();
338+
APInt DemandedElts = VT.isFixedLengthVector()
339+
? APInt::getAllOnes(VT.getVectorNumElements())
340+
: APInt(1, 1);
341+
return SimplifyDemandedBits(Op, DemandedBits, DemandedElts, false);
347342
}
348343

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

0 commit comments

Comments
 (0)