diff options
author | Nirav Dave <niravd@google.com> | 2018-08-28 18:13:00 +0000 |
---|---|---|
committer | Nirav Dave <niravd@google.com> | 2018-08-28 18:13:00 +0000 |
commit | 113f2b90588b71f53137395de298122ad10e94d8 (patch) | |
tree | 938b88c3928cf6159ff2536a2f63491c3ce5bc81 | |
parent | 0b8cb46e0b8f593221478fa24a35bcf3e56edfaa (diff) | |
download | bcm5719-llvm-113f2b90588b71f53137395de298122ad10e94d8.tar.gz bcm5719-llvm-113f2b90588b71f53137395de298122ad10e94d8.zip |
[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
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 534585685c8..884cc0329db 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -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. RemoveNodeFromCSEMaps(User); - // A user can appear in a use list multiple times, and when this - // happens the uses are usually next to each other in the list. - // To help reduce the number of CSE recomputations, process all - // the uses of this user that we can find this way. + // A user can appear in a use list multiple times, and when this happens the + // uses are usually next to each other in the list. To help reduce the + // number of CSE and divergence recomputations, process all the uses of this + // user that we can find this way. + bool To_IsDivergent = false; do { SDUse &Use = UI.getUse(); const SDValue &ToOp = To[Use.getResNo()]; ++UI; Use.set(ToOp); - if (ToOp->isDivergent() != From->isDivergent()) - updateDivergence(User); + To_IsDivergent |= ToOp->isDivergent(); } 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 // already exists there, recursively merge the results together. AddModifiedNodeToCSEMaps(User); |