<div dir="ltr"><div>Yes - sorry about that. I don't usually check-clang with an optimizer patch (because I shouldn't have to...). But there's a clang test (tools/clang/test/CodeGen/<wbr>zvector.c) that depends on the optimizer, so it needs to be fixed/hacked because the output changed.<br><br>I reverted my commit while I look at it :<br><a href="https://reviews.llvm.org/rL297166" rel="noreferrer" target="_blank">rL297166</a><br></div><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 7, 2017 at 11:08 AM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Are you looking into all the failures?<div><br></div><div><a href="http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/4406" target="_blank">http://lab.llvm.org:8011/build<wbr>ers/clang-cmake-aarch64-quick/<wbr>builds/4406</a><br></div></div><br><div class="gmail_quote"><div><div class="gmail-m_7650828568133416079h5"><div dir="ltr">On Tue, Mar 7, 2017 at 8:30 AM Sanjay Patel via Phabricator via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_7650828568133416079h5">This revision was automatically updated to reflect the committed changes.<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
Closed by commit rL297155: [InstCombine] shrink truncated splat shuffle (authored by spatel).<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
Changed prior to commit:<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<a href="https://reviews.llvm.org/D30123?vs=89025&id=90857#toc" rel="noreferrer" class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg" target="_blank">https://reviews.llvm.org/D3012<wbr>3?vs=89025&id=90857#toc</a><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
Repository:<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
rL LLVM<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<a href="https://reviews.llvm.org/D30123" rel="noreferrer" class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg" target="_blank">https://reviews.llvm.org/D3012<wbr>3</a><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
Files:<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineCasts.cpp<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
llvm/trunk/test/Transforms/Ins<wbr>tCombine/trunc.ll<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
Index: llvm/trunk/test/Transforms/Ins<wbr>tCombine/trunc.ll<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
==============================<wbr>==============================<wbr>=======<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
--- llvm/trunk/test/Transforms/Ins<wbr>tCombine/trunc.ll<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+++ llvm/trunk/test/Transforms/Ins<wbr>tCombine/trunc.ll<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
@@ -478,28 +478,26 @@<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
ret <4 x i8> %trunc<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
}<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
-; FIXME:<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
; trunc (shuffle X, undef, SplatMask) --> shuffle (trunc X), undef, SplatMask<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
define <4 x i8> @wide_splat1(<4 x i32> %x) {<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
; CHECK-LABEL: @wide_splat1(<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
-; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 2, i32 2, i32 2, i32 2><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
-; CHECK-NEXT: [[TRUNC:%.*]] = trunc <4 x i32> [[SHUF]] to <4 x i8><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+; CHECK-NEXT: [[TMP1:%.*]] = trunc <4 x i32> %x to <4 x i8><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+; CHECK-NEXT: [[TRUNC:%.*]] = shufflevector <4 x i8> [[TMP1]], <4 x i8> undef, <4 x i32> <i32 2, i32 2, i32 2, i32 2><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
; CHECK-NEXT: ret <4 x i8> [[TRUNC]]<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
;<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
%shuf = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> <i32 2, i32 2, i32 2, i32 2><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
%trunc = trunc <4 x i32> %shuf to <4 x i8><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
ret <4 x i8> %trunc<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
}<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
-; FIXME:<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
; Test weird types.<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
; trunc (shuffle X, undef, SplatMask) --> shuffle (trunc X), undef, SplatMask<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
define <3 x i31> @wide_splat2(<3 x i33> %x) {<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
; CHECK-LABEL: @wide_splat2(<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
-; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <3 x i33> %x, <3 x i33> undef, <3 x i32> <i32 1, i32 1, i32 1><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
-; CHECK-NEXT: [[TRUNC:%.*]] = trunc <3 x i33> [[SHUF]] to <3 x i31><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+; CHECK-NEXT: [[TMP1:%.*]] = trunc <3 x i33> %x to <3 x i31><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+; CHECK-NEXT: [[TRUNC:%.*]] = shufflevector <3 x i31> [[TMP1]], <3 x i31> undef, <3 x i32> <i32 1, i32 1, i32 1><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
; CHECK-NEXT: ret <3 x i31> [[TRUNC]]<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
;<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
%shuf = shufflevector <3 x i33> %x, <3 x i33> undef, <3 x i32> <i32 1, i32 1, i32 1><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
Index: llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineCasts.cpp<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
==============================<wbr>==============================<wbr>=======<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
--- llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineCasts.cpp<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+++ llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineCasts.cpp<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
@@ -463,6 +463,23 @@<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
return BinaryOperator::Create(LogicOp<wbr>->getOpcode(), NarrowOp0, NarrowC);<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
}<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+/// Try to narrow the width of a splat shuffle. This could be generalized to any<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+/// shuffle with a constant operand, but we limit the transform to avoid<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+/// creating a shuffle type that targets may not be able to lower effectively.<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+static Instruction *shrinkSplatShuffle(TruncInst &Trunc,<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ InstCombiner::BuilderTy &Builder) {<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ auto *Shuf = dyn_cast<ShuffleVectorInst>(Tr<wbr>unc.getOperand(0));<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ if (Shuf && Shuf->hasOneUse() && isa<UndefValue>(Shuf->getOpera<wbr>nd(1)) &&<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ Shuf->getMask()->getSplatValue<wbr>()) {<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ // trunc (shuf X, Undef, SplatMask) --> shuf (trunc X), Undef, SplatMask<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ Constant *NarrowUndef = UndefValue::get(Trunc.getType(<wbr>));<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ Value *NarrowOp = Builder.CreateTrunc(Shuf->getO<wbr>perand(0), Trunc.getType());<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ return new ShuffleVectorInst(NarrowOp, NarrowUndef, Shuf->getMask());<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ }<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ return nullptr;<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+}<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
Instruction *InstCombiner::visitTrunc(Trun<wbr>cInst &CI) {<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
if (Instruction *Result = commonCastTransforms(CI))<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
return Result;<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
@@ -554,6 +571,9 @@<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
if (Instruction *I = shrinkBitwiseLogic(CI))<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
return I;<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ if (Instruction *I = shrinkSplatShuffle(CI, *Builder))<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+ return I;<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
+<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
if (Src->hasOneUse() && isa<IntegerType>(SrcTy) &&<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
shouldChangeType(SrcTy, DestTy)) {<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
// Transform "trunc (shl X, cst)" -> "shl (trunc X), cst" so long as the<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg"></div></div>
______________________________<wbr>_________________<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
llvm-commits mailing list<br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br class="gmail-m_7650828568133416079m_6603233983154850719gmail_msg">
</blockquote></div>
</blockquote></div><br></div></div>