mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-10 22:43:53 +00:00
[DAG] Avoid recomputing Divergence checks. NFCI.
When making multiple updates to the same SDNode, recompute node divergence only once after all changes have been made. llvm-svn: 340852
This commit is contained in:
parent
52a17527a0
commit
741515d89c
@ -7806,18 +7806,22 @@ void SelectionDAG::ReplaceAllUsesWith(SDNode *From, const SDValue *To) {
|
|||||||
// This node is about to morph, remove its old self from the CSE maps.
|
// This node is about to morph, remove its old self from the CSE maps.
|
||||||
RemoveNodeFromCSEMaps(User);
|
RemoveNodeFromCSEMaps(User);
|
||||||
|
|
||||||
// A user can appear in a use list multiple times, and when this
|
// A user can appear in a use list multiple times, and when this happens the
|
||||||
// happens the uses are usually next to each other in the list.
|
// uses are usually next to each other in the list. To help reduce the
|
||||||
// To help reduce the number of CSE recomputations, process all
|
// number of CSE and divergence recomputations, process all the uses of this
|
||||||
// the uses of this user that we can find this way.
|
// user that we can find this way.
|
||||||
|
bool To_IsDivergent = false;
|
||||||
do {
|
do {
|
||||||
SDUse &Use = UI.getUse();
|
SDUse &Use = UI.getUse();
|
||||||
const SDValue &ToOp = To[Use.getResNo()];
|
const SDValue &ToOp = To[Use.getResNo()];
|
||||||
++UI;
|
++UI;
|
||||||
Use.set(ToOp);
|
Use.set(ToOp);
|
||||||
if (ToOp->isDivergent() != From->isDivergent())
|
To_IsDivergent |= ToOp->isDivergent();
|
||||||
updateDivergence(User);
|
|
||||||
} while (UI != UE && *UI == User);
|
} while (UI != UE && *UI == User);
|
||||||
|
|
||||||
|
if (To_IsDivergent != From->isDivergent())
|
||||||
|
updateDivergence(User);
|
||||||
|
|
||||||
// Now that we have modified User, add it back to the CSE maps. If it
|
// Now that we have modified User, add it back to the CSE maps. If it
|
||||||
// already exists there, recursively merge the results together.
|
// already exists there, recursively merge the results together.
|
||||||
AddModifiedNodeToCSEMaps(User);
|
AddModifiedNodeToCSEMaps(User);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user