Skip to content

[SelectionDAG] late init DeferredNodes #123461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2025
Merged

Conversation

klensy
Copy link
Contributor

@klensy klensy commented Jan 18, 2025

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

@llvmbot llvmbot added the llvm:SelectionDAG SelectionDAGISel as well label Jan 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 18, 2025

@llvm/pr-subscribers-llvm-selectiondag

Author: klensy (klensy)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/123461.diff

1 Files Affected:

  • (modified) llvm/include/llvm/CodeGen/SelectionDAGNodes.h (+1-1)
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

Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@topperc
Copy link
Collaborator

topperc commented Jan 19, 2025

@klensy do you need someone to commit this?

@klensy
Copy link
Contributor Author

klensy commented Jan 19, 2025

@klensy do you need someone to commit this?

Yes, please.

@arsenm arsenm merged commit b5df0e7 into llvm:main Jan 19, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:SelectionDAG SelectionDAGISel as well
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants