Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

This patch switches to SmallVector so that we can construct an
instance with an iterator range.

This patch switches to SmallVector so that we can construct an
instance with an iterator range.
@llvmbot
Copy link
Member

llvmbot commented Apr 19, 2025

@llvm/pr-subscribers-backend-hexagon

Author: Kazu Hirata (kazutakahirata)

Changes

This patch switches to SmallVector so that we can construct an
instance with an iterator range.


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

1 Files Affected:

  • (modified) llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp (+1-3)
diff --git a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
index 79169a0c20e58..9604f252dd3df 100644
--- a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
@@ -1079,9 +1079,7 @@ bool PolynomialMultiplyRecognize::promoteTypes(BasicBlock *LoopB,
       return false;
 
   // Perform the promotion.
-  std::vector<Instruction*> LoopIns;
-  std::transform(LoopB->begin(), LoopB->end(), std::back_inserter(LoopIns),
-                 [](Instruction &In) { return &In; });
+  SmallVector<Instruction *> LoopIns(llvm::make_pointer_range(*LoopB));
   for (Instruction *In : LoopIns)
     if (!In->isTerminator())
       promoteTo(In, DestTy, LoopB);

@kazutakahirata kazutakahirata merged commit 6b2fd90 into llvm:main Apr 19, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_SmallVector_iter_range_llvm_Hexagon branch April 19, 2025 16:10
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…6416)

This patch switches to SmallVector so that we can construct an
instance with an iterator range.
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