[llvm] 7920805 - [DAG] Use recursivelyDeleteUnusedNodes in ReplaceLoadWithPromotedLoad

Amaury Séchet via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 05:32:43 PDT 2022


Author: Amaury Séchet
Date: 2022-07-28T12:32:37Z
New Revision: 7920805b27fd193293aa9f174983ef50758b2929

URL: https://github.com/llvm/llvm-project/commit/7920805b27fd193293aa9f174983ef50758b2929
DIFF: https://github.com/llvm/llvm-project/commit/7920805b27fd193293aa9f174983ef50758b2929.diff

LOG: [DAG] Use recursivelyDeleteUnusedNodes in ReplaceLoadWithPromotedLoad

It simplifies the code overall and removes the need for manual bookkeeping.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D130444

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 654879115ff95..12398130447e0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1263,11 +1263,12 @@ void DAGCombiner::ReplaceLoadWithPromotedLoad(SDNode *Load, SDNode *ExtLoad) {
 
   LLVM_DEBUG(dbgs() << "\nReplacing.9 "; Load->dump(&DAG); dbgs() << "\nWith: ";
              Trunc.dump(&DAG); dbgs() << '\n');
-  WorklistRemover DeadNodes(*this);
+
   DAG.ReplaceAllUsesOfValueWith(SDValue(Load, 0), Trunc);
   DAG.ReplaceAllUsesOfValueWith(SDValue(Load, 1), SDValue(ExtLoad, 1));
-  deleteAndRecombine(Load);
+
   AddToWorklist(Trunc.getNode());
+  recursivelyDeleteUnusedNodes(Load);
 }
 
 SDValue DAGCombiner::PromoteOperand(SDValue Op, EVT PVT, bool &Replace) {


        


More information about the llvm-commits mailing list