<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr"><div class="gmail_extra">On Tue, Jan 1, 2013 at 11:55 AM, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@googlemail.com" target="_blank" class="cremed">benny.kra@googlemail.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":e1w">==============================================================================<br>
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Tue Jan 1 13:55:16 2013<br>
@@ -2660,18 +2660,7 @@<br>
<br>
/// \brief Compute a vector splat for a given element value.<br>
Value *getVectorSplat(IRBuilder<> &IRB, Value *V, unsigned NumElements) {<br>
- assert(NumElements > 0 && "Cannot splat to an empty vector.");<br>
-<br>
- // First insert it into a one-element vector so we can shuffle it. It is<br>
- // really silly that LLVM's IR requires this in order to form a splat.<br>
- Value *Undef = UndefValue::get(VectorType::get(V->getType(), 1));<br>
- V = IRB.CreateInsertElement(Undef, V, IRB.getInt32(0),<br>
- getName(".splatinsert"));<br>
-<br>
- // Shuffle the value across the desired number of elements.<br>
- SmallVector<Constant*, 8> Mask(NumElements, IRB.getInt32(0));<br>
- V = IRB.CreateShuffleVector(V, Undef, ConstantVector::get(Mask),<br>
- getName(".splat"));<br>
+ V = IRB.CreateVectorSplat(NumElements, V, NamePrefix);<br>
DEBUG(dbgs() << " splat: " << *V << "\n");<br>
return V;<br>
}<br></div></blockquote></div><br></div><div class="gmail_extra" style>Why not inline this into the callers?</div></div></div>