[llvm] b5df0e7 - [SelectionDAG] late init DeferredNodes (#123461)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 19 04:35:43 PST 2025


Author: klensy
Date: 2025-01-19T19:35:38+07:00
New Revision: b5df0e71082fc9b11a9ecf85599a453d21f1025a

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

LOG: [SelectionDAG] late init DeferredNodes (#123461)

No need to init `SmallVector` (even stack allocated) if we can exit
literally on next line.

Co-authored-by: klensy <nightouser at gmail.com>

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index 03899493847b39..49467ce0a54cd0 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -916,10 +916,10 @@ END_TWO_BYTE_PACK()
                                    SmallVectorImpl<const SDNode *> &Worklist,
                                    unsigned int MaxSteps = 0,
                                    bool TopologicalPrune = false) {
-    SmallVector<const SDNode *, 8> DeferredNodes;
     if (Visited.count(N))
       return true;
 
+    SmallVector<const SDNode *, 8> DeferredNodes;
     // Node Id's are assigned in three places: As a topological
     // ordering (> 0), during legalization (results in values set to
     // 0), new nodes (set to -1). If N has a topolgical id then we


        


More information about the llvm-commits mailing list