[DAGCombine] Factor oplist operations. NFC

This commit is contained in:
Amaury Séchet 2019-12-02 18:35:59 +01:00
parent bf535ac4a2
commit c594d14d40
1 changed files with 10 additions and 6 deletions

View File

@ -180,6 +180,12 @@ namespace {
AddToWorklist(Node); AddToWorklist(Node);
} }
/// Convenient shorthand to add a node and all of its user to the worklist.
void AddToWorklistWithUsers(SDNode *N) {
AddUsersToWorklist(N);
AddToWorklist(N);
}
// Prune potentially dangling nodes. This is called after // Prune potentially dangling nodes. This is called after
// any visit to a node, but should also be called during a visit after any // any visit to a node, but should also be called during a visit after any
// failed combine which may have created a DAG node. // failed combine which may have created a DAG node.
@ -1427,10 +1433,9 @@ void DAGCombiner::Run(CombineLevel AtLevel) {
SmallSetVector<SDNode *, 16> UpdatedNodes; SmallSetVector<SDNode *, 16> UpdatedNodes;
bool NIsValid = DAG.LegalizeOp(N, UpdatedNodes); bool NIsValid = DAG.LegalizeOp(N, UpdatedNodes);
for (SDNode *LN : UpdatedNodes) { for (SDNode *LN : UpdatedNodes)
AddUsersToWorklist(LN); AddToWorklistWithUsers(LN);
AddToWorklist(LN);
}
if (!NIsValid) if (!NIsValid)
continue; continue;
} }
@ -16990,8 +16995,7 @@ SDValue DAGCombiner::scalarizeExtractedVectorLoad(SDNode *EVE, EVT InVecVT,
AddToWorklist(EVE); AddToWorklist(EVE);
// Since we're explicitly calling ReplaceAllUses, add the new node to the // Since we're explicitly calling ReplaceAllUses, add the new node to the
// worklist explicitly as well. // worklist explicitly as well.
AddUsersToWorklist(Load.getNode()); // Add users too AddToWorklistWithUsers(Load.getNode());
AddToWorklist(Load.getNode());
++OpsNarrowed; ++OpsNarrowed;
return SDValue(EVE, 0); return SDValue(EVE, 0);
} }