[llvm-branch-commits] [llvm] a591261 - [IRBuilder] "Zero"-initialize SmallVector (NFC)

Kazu Hirata via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jan 17 10:45:06 PST 2021


Author: Kazu Hirata
Date: 2021-01-17T10:39:47-08:00
New Revision: a59126115e9586dd7fda4bb365ee43682814fc53

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

LOG: [IRBuilder] "Zero"-initialize SmallVector (NFC)

Added: 
    

Modified: 
    llvm/lib/IR/IRBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index 7e76a6c2a055..91ca984b755c 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -1047,9 +1047,7 @@ Value *IRBuilderBase::CreatePreserveArrayAccessIndex(
 
   Value *LastIndexV = getInt32(LastIndex);
   Constant *Zero = ConstantInt::get(Type::getInt32Ty(Context), 0);
-  SmallVector<Value *, 4> IdxList;
-  for (unsigned I = 0; I < Dimension; ++I)
-    IdxList.push_back(Zero);
+  SmallVector<Value *, 4> IdxList(Dimension, Zero);
   IdxList.push_back(LastIndexV);
 
   Type *ResultType =


        


More information about the llvm-branch-commits mailing list