[llvm] r310648 - [DAG] Cleanup unused nodes after store merge. NFCI.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 11:53:14 PDT 2017
Author: niravd
Date: Thu Aug 10 11:53:14 2017
New Revision: 310648
URL: http://llvm.org/viewvc/llvm-project?rev=310648&view=rev
Log:
[DAG] Cleanup unused nodes after 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=310648&r1=310647&r2=310648&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Aug 10 11:53:14 2017
@@ -12552,8 +12552,15 @@ bool DAGCombiner::MergeStoresOfConstants
}
// Replace all merged stores with the new store.
- for (unsigned i = 0; i < NumStores; ++i)
+ for (unsigned i = 0; i < NumStores; ++i) {
+ SDValue Val = StoreNodes[i].MemNode->getOperand(1);
+ SDValue Addr = StoreNodes[i].MemNode->getOperand(2);
CombineTo(StoreNodes[i].MemNode, NewStore);
+ if (Val.getNode()->use_empty())
+ recursivelyDeleteUnusedNodes(Val.getNode());
+ if (Addr.getNode()->use_empty())
+ recursivelyDeleteUnusedNodes(Addr.getNode());
+ }
AddToWorklist(NewChain.getNode());
return true;
@@ -13186,9 +13193,12 @@ bool DAGCombiner::MergeConsecutiveStores
// corresponding value if its no longer used.
for (unsigned i = 0; i < NumElem; ++i) {
SDValue Val = StoreNodes[i].MemNode->getOperand(1);
+ SDValue Addr = StoreNodes[i].MemNode->getOperand(2);
CombineTo(StoreNodes[i].MemNode, NewStore);
if (Val.getNode()->use_empty())
recursivelyDeleteUnusedNodes(Val.getNode());
+ if (Addr.getNode()->use_empty())
+ recursivelyDeleteUnusedNodes(Addr.getNode());
}
RV = true;
More information about the llvm-commits
mailing list