use the getSplat API. Patch by Paul Redmond.
authorNadav Rotem <nrotem@apple.com>
Wed, 14 Nov 2012 00:02:13 +0000 (00:02 +0000)
committerNadav Rotem <nrotem@apple.com>
Wed, 14 Nov 2012 00:02:13 +0000 (00:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167892 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/LoopVectorize.cpp

index a7ef248e6e3dacddd17d5c8eecd00601e64e0b57..12e4db6b38fbd5a0d8ecdbc77f1a13950f0cf19c 100644 (file)
@@ -549,13 +549,7 @@ Value *SingleBlockLoopVectorizer::getVectorValue(Value *V) {
 
 Constant*
 SingleBlockLoopVectorizer::getUniformVector(unsigned Val, Type* ScalarTy) {
-  SmallVector<Constant*, 8> Indices;
-  // Create a vector of consecutive numbers from zero to VF.
-  for (unsigned i = 0; i < VF; ++i)
-    Indices.push_back(ConstantInt::get(ScalarTy, Val, true));
-
-  // Add the consecutive indices to the vector value.
-  return ConstantVector::get(Indices);
+  return ConstantVector::getSplat(VF, ConstantInt::get(ScalarTy, Val, true));
 }
 
 void SingleBlockLoopVectorizer::scalarizeInstruction(Instruction *Instr) {