[llvm] 7c878f4 - [InstCombine] Directly iterate over users (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 01:40:27 PDT 2023


Author: Nikita Popov
Date: 2023-05-24T10:39:32+02:00
New Revision: 7c878f45040ec829713ff091470449b4b093b321

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

LOG: [InstCombine] Directly iterate over users (NFC)

After 3a223f1eafe331508d171b519df8a4984791ab48, it's no longer
necessary to put the users into a vector. We can directly iterate
them instead.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 98a66db47f63..3a863f29e3c7 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -743,8 +743,7 @@ static void replaceExtractElements(InsertElementInst *InsElt,
 
   // Replace extracts from the original narrow vector with extracts from the new
   // wide vector.
-  SmallVector<User *> Users(ExtVecOp->users());
-  for (User *U : Users) {
+  for (User *U : ExtVecOp->users()) {
     ExtractElementInst *OldExt = dyn_cast<ExtractElementInst>(U);
     if (!OldExt || OldExt->getParent() != WideVec->getParent())
       continue;


        


More information about the llvm-commits mailing list