Skip to content

[Scalar] Construct SmallVector with an iterator range (NFC) #135725

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

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Apr 15, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/NewGVN.cpp (+1-2)
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index 44971af5841ea..58de4c0aab221 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -3195,8 +3195,7 @@ bool NewGVN::singleReachablePHIPath(
   };
   auto FilteredPhiArgs =
       make_filter_range(MP->operands(), ReachableOperandPred);
-  SmallVector<const Value *, 32> OperandList;
-  llvm::copy(FilteredPhiArgs, std::back_inserter(OperandList));
+  SmallVector<const Value *, 32> OperandList(FilteredPhiArgs);
   bool Okay = all_equal(OperandList);
   if (Okay)
     return singleReachablePHIPath(Visited, cast<MemoryAccess>(OperandList[0]),

@kazutakahirata kazutakahirata merged commit 01c1c78 into llvm:main Apr 15, 2025
12 of 13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_range_SmallVector branch April 15, 2025 05:22
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
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.

3 participants