[llvm] 8823abe - InstCombine: Simplify vector initialization

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon May 13 04:59:50 PDT 2024


Author: Matt Arsenault
Date: 2024-05-13T13:59:45+02:00
New Revision: 8823abea6fb029bf24abd501e43844e3f5b9c444

URL: https://github.com/llvm/llvm-project/commit/8823abea6fb029bf24abd501e43844e3f5b9c444
DIFF: https://github.com/llvm/llvm-project/commit/8823abea6fb029bf24abd501e43844e3f5b9c444.diff

LOG: InstCombine: Simplify vector initialization

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 344f3ec74522d..537890d9025fe 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -382,8 +382,7 @@ void PointerReplacer::replace(Instruction *I) {
   } else if (auto *GEP = dyn_cast<GetElementPtrInst>(I)) {
     auto *V = getReplacement(GEP->getPointerOperand());
     assert(V && "Operand not replaced");
-    SmallVector<Value *, 8> Indices;
-    Indices.append(GEP->idx_begin(), GEP->idx_end());
+    SmallVector<Value *, 8> Indices(GEP->indices());
     auto *NewI =
         GetElementPtrInst::Create(GEP->getSourceElementType(), V, Indices);
     IC.InsertNewInstWith(NewI, GEP->getIterator());


        


More information about the llvm-commits mailing list