Skip to content

[DFAJumpThreading][NFC] Use const reference as range variable #90342

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 2 commits into from
Apr 27, 2024

Conversation

XChy
Copy link
Member

@XChy XChy commented Apr 27, 2024

Fixes #90286

@llvmbot
Copy link
Member

llvmbot commented Apr 27, 2024

@llvm/pr-subscribers-llvm-transforms

Author: XChy (XChy)

Changes

Fixes #90286


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp (+1-1)
diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index 14cdcc956aa5d7..fe5eeb1dcdf32f 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -553,7 +553,7 @@ struct AllSwitchPaths {
       return;
     }
 
-    for (PathType Path : LoopPaths) {
+    for (const PathType& Path : LoopPaths) {
       ThreadingPath TPath;
 
       const BasicBlock *PrevBB = Path.back();

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff b5e8555607ed39816dd05e8b6fafa2774305e825 8084544a63f449c59635d6f31888f2b12ba293b9 -- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index fe5eeb1dcd..ba2546b8db 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -553,7 +553,7 @@ struct AllSwitchPaths {
       return;
     }
 
-    for (const PathType& Path : LoopPaths) {
+    for (const PathType &Path : LoopPaths) {
       ThreadingPath TPath;
 
       const BasicBlock *PrevBB = Path.back();

@XChy XChy merged commit 7b5b521 into llvm:main Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp:548: Poor choice of range variable type ?
3 participants