[llvm] r310474 - [DAG] Explicitly cleanup merged load values during store merge. NFCI.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 06:37:07 PDT 2017
Author: niravd
Date: Wed Aug 9 06:37:07 2017
New Revision: 310474
URL: http://llvm.org/viewvc/llvm-project?rev=310474&view=rev
Log:
[DAG] Explicitly cleanup merged load values during store merge. NFCI.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=310474&r1=310473&r2=310474&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Aug 9 06:37:07 2017
@@ -13182,9 +13182,15 @@ bool DAGCombiner::MergeConsecutiveStores
SDValue(NewLoad.getNode(), 1));
}
- // Replace the all stores with the new store.
- for (unsigned i = 0; i < NumElem; ++i)
+ // Replace the all stores with the new store. Recursively remove
+ // corresponding value if its no longer used.
+ for (unsigned i = 0; i < NumElem; ++i) {
+ SDValue Val = StoreNodes[i].MemNode->getOperand(1);
CombineTo(StoreNodes[i].MemNode, NewStore);
+ if (Val.getNode()->use_empty())
+ recursivelyDeleteUnusedNodes(Val.getNode());
+ }
+
RV = true;
StoreNodes.erase(StoreNodes.begin(), StoreNodes.begin() + NumElem);
continue;
More information about the llvm-commits
mailing list