[llvm-commits] [llvm] r171349 - in /llvm/trunk: include/llvm/IRBuilder.h lib/Transforms/Scalar/SROA.cpp lib/Transforms/Vectorize/LoopVectorize.cpp

Chandler Carruth chandlerc at google.com
Tue Jan 1 23:22:19 PST 2013


On Tue, Jan 1, 2013 at 11:55 AM, Benjamin Kramer
<benny.kra at googlemail.com>wrote:

>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Tue Jan  1 13:55:16 2013
> @@ -2660,18 +2660,7 @@
>
>    /// \brief Compute a vector splat for a given element value.
>    Value *getVectorSplat(IRBuilder<> &IRB, Value *V, unsigned NumElements)
> {
> -    assert(NumElements > 0 && "Cannot splat to an empty vector.");
> -
> -    // First insert it into a one-element vector so we can shuffle it. It
> is
> -    // really silly that LLVM's IR requires this in order to form a splat.
> -    Value *Undef = UndefValue::get(VectorType::get(V->getType(), 1));
> -    V = IRB.CreateInsertElement(Undef, V, IRB.getInt32(0),
> -                                getName(".splatinsert"));
> -
> -    // Shuffle the value across the desired number of elements.
> -    SmallVector<Constant*, 8> Mask(NumElements, IRB.getInt32(0));
> -    V = IRB.CreateShuffleVector(V, Undef, ConstantVector::get(Mask),
> -                                getName(".splat"));
> +    V = IRB.CreateVectorSplat(NumElements, V, NamePrefix);
>      DEBUG(dbgs() << "       splat: " << *V << "\n");
>      return V;
>    }
>

Why not inline this into the callers?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130101/3880cdff/attachment.html>


More information about the llvm-commits mailing list