[llvm-commits] [polly] r151912 - in /polly/trunk: lib/CodeGeneration.cpp test/CodeGen/simple_vec_assign_scalar_2.ll
Tobias Grosser
grosser at fim.uni-passau.de
Fri Mar 2 07:20:22 PST 2012
Author: grosser
Date: Fri Mar 2 09:20:21 2012
New Revision: 151912
URL: http://llvm.org/viewvc/llvm-project?rev=151912&view=rev
Log:
CodeGen: Simplify the generation of a splat
Modified:
polly/trunk/lib/CodeGeneration.cpp
polly/trunk/test/CodeGen/simple_vec_assign_scalar_2.ll
Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=151912&r1=151911&r2=151912&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Fri Mar 2 09:20:21 2012
@@ -523,17 +523,10 @@
if (Operand->getType()->isVectorTy())
return Operand;
- VectorType *VectorType = VectorType::get(Operand->getType(), VectorWidth);
- Value *Vector = UndefValue::get(VectorType);
+ Value *Vector = UndefValue::get(VectorType::get(Operand->getType(), 1));
Vector = Builder.CreateInsertElement(Vector, Operand, Builder.getInt32(0));
-
- std::vector<Constant*> Splat;
-
- for (int i = 0; i < VectorWidth; i++)
- Splat.push_back (Builder.getInt32(0));
-
- Constant *SplatVector = ConstantVector::get(Splat);
-
+ Constant *SplatVector = ConstantVector::getSplat(VectorWidth,
+ Builder.getInt32(0));
return Builder.CreateShuffleVector(Vector, Vector, SplatVector);
}
Modified: polly/trunk/test/CodeGen/simple_vec_assign_scalar_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/CodeGen/simple_vec_assign_scalar_2.ll?rev=151912&r1=151911&r2=151912&view=diff
==============================================================================
--- polly/trunk/test/CodeGen/simple_vec_assign_scalar_2.ll (original)
+++ polly/trunk/test/CodeGen/simple_vec_assign_scalar_2.ll Fri Mar 2 09:20:21 2012
@@ -41,7 +41,7 @@
ret i32 %tmp1
}
-; CHECK: insertelement <4 x float> undef, float %p_tmp4, i32 0
-; CHECK: shufflevector <4 x float> %0, <4 x float> %0, <4 x i32> zeroinitializer
+; CHECK: insertelement <1 x float> undef, float %p_tmp4, i32 0
+; CHECK: shufflevector <1 x float> %0, <1 x float> %0, <4 x i32> zeroinitializer
; CHECK: fadd <4 x float> %tmp_p_vec_full, %1
More information about the llvm-commits
mailing list