<div dir="ltr"><div>I was circling back to this problem thinking this was just a failure of InstSimplify (this was the inspiration for <a href="https://reviews.llvm.org/rL288833" rel="noreferrer" target="_blank">https://reviews.llvm.org/rL288<wbr>833</a> / <a href="https://reviews.llvm.org/rL288841" rel="noreferrer" target="_blank">https://reviews.llvm.org/rL288<wbr>841</a> ).<br>But given Eli's observation about InstSimplify's ( <a href="https://reviews.llvm.org/rL288855" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>rL288855</a> ) limitations, I wonder if we should just deal with this as an InstCombine problem.<br></div><div><div class="gmail_extra"><br></div><div class="gmail_extra">Example:<br><br></div><div class="gmail_extra">define i1 @good(i32 %a, i32 %b) {<br>  %cmp1 = icmp sgt i32 %a, 20<br>  %sel = select i1 %cmp1, i32 20, i32 %a<br>  %cmp2 = icmp slt i32 %sel, %a<br>  ret i1 %cmp2<br>}<br><br>define i1 @bad(i32 %a, i32 %b) {<br>  %1 = icmp slt i32 %a, 20<br>  %sel = select i1 %1, i32 %a, i32 20   <--- this is currently the canonical form for min/max<br>  %cmp2 = icmp slt i32 %sel, %a<br>  ret i1 %cmp2<br>}<br><br>$ ./opt  -instsimplify minmaxsimp.ll -S<br>define i1 @good(i32 %a, i32 %b) {<br>  %cmp1 = icmp sgt i32 %a, 20<br>  ret i1 %cmp1<br>}<br><br>define i1 @bad(i32 %a, i32 %b) {<br>  %1 = icmp slt i32 %a, 20              <--- can't "simplify" because the icmp we want doesn't already exist?<br>  %sel = select i1 %1, i32 %a, i32 20<br>  %cmp2 = icmp slt i32 %sel, %a<br>  ret i1 %cmp2<br>}<br><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 2:50 PM, Volkan Keles <span dir="ltr"><<a href="mailto:vkeles@apple.com" target="_blank">vkeles@apple.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><div>%tmp14 can be exactly 20. The code blocks which tries to simplify comparisons involving max/min in simplifyICmpWithConstant (InstructionSimplify.cpp:2938) sets the variable P to ICMP_SGT. It needs to be ICMP_SGE in order to yield `i1 true`.</div><span class="gmail-m_4657524291297788233gmail-m_2794373365203319070HOEnZb"><font color="#888888"><div><br></div><div>Volkan</div></font></span><div><div class="gmail-m_4657524291297788233gmail-m_2794373365203319070h5"><br><div><blockquote type="cite"><div>On Dec 1, 2016, at 6:50 PM, Sanjay Patel <<a href="mailto:spatel@rotateright.com" target="_blank">spatel@rotateright.com</a>> wrote:</div><br class="gmail-m_4657524291297788233gmail-m_2794373365203319070m_6682116336551278699Apple-interchange-newline"><div><div dir="ltr"><div><div>Hi Volkan,<br><br></div>I didn't look at the attachment yet, but let me make sure that I'm understanding the problem.<br></div>SimplifyCmpInst() can determine that %tmp14 is not greater than 20, but it cannot determine that %tmp14 is less than 20? So either we're missing some analysis or %tmp14 can be exactly 20, and that's throwing off the analysis?<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 1, 2016 at 11:30 AM, Volkan Keles <span dir="ltr"><<a href="mailto:vkeles@apple.com" target="_blank">vkeles@apple.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">Hi Sanjay,<br>
<br>
InstCombiner fails to constant fold some of comparisons involving min/max if we canonicalize min/max with constant. Can you please check the attached IR?<br>
<br>
We have:<br>
%tmp11 = phi i32 [ 0, %bb ], [ %tmp14, %for.inc.73 ]<br>
%cmp31 = icmp sgt i32 %tmp11, 20<br>
%tmp14 = select i1 %cmp31, i32 20, i32 %tmp11<br>
<br>
Here, it tries to simplify the comparison instruction by checking if comparing all the incoming values yields the same value.<br>
SimplifyCmpInst(ICMP_SGT, i32 0, i32 20, ...) = i1 false<br>
SimplifyCmpInst(ICMP_SGT, %tmp14, i32 20, …) = i1 false<br>
<br>
If we canonicalize min/max with constant, the instructions will be as below.<br>
%tmp11 = phi i32 [ 0, %bb ], [ %tmp14, %for.inc.73 ]<br>
%0 = icmp slt i32 %tmp11, 20<br>
%tmp14 = select i1 %0, i32 %tmp11, i32 20<br>
<br>
If we try the same simplification with these instructions, the second call yields the comparison instruction.<br>
SimplifyCmpInst(ICMP_SLT, i32 0, i32 20, …) = i1 true<br>
SimplifyCmpInst(ICMP_SLT, %tmp14, i32 20, …) = %0 = icmp slt i32 %tmp11, 20<br>
<br>
Thank you,<br>
Volkan<br>
<br>
<br><br>
> On Nov 21, 2016, at 10:04 PM, Sanjay Patel via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: spatel<br>
> Date: Mon Nov 21 16:04:14 2016<br>
> New Revision: 287585<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=287585&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=287585&view=rev</a><br>
> Log:<br>
> [InstCombine] canonicalize min/max constant to select's false value<br>
><br>
> This is a first step towards canonicalization and improved folding/codegen<br>
> for integer min/max as discussed here:<br>
> <a href="http://lists.llvm.org/pipermail/llvm-dev/2016-November/106868.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermai<wbr>l/llvm-dev/2016-November/10686<wbr>8.html</a><br>
><br>
> Here, we're just matching the simplest min/max patterns and adjusting the<br>
> icmp predicate while swapping the select operands.<br>
><br>
> I've included FIXME tests in test/Transforms/InstCombine/se<wbr>lect_meta.ll<br>
> so it's easier to see how this might be extended (corresponds to the TODO<br>
> comment in the code). That's also why I'm using matchSelectPattern()<br>
> rather than a simpler check; once the backend is patched, we can just<br>
> remove some of the restrictions to allow the obfuscated min/max patterns<br>
> in the FIXME tests to be matched.<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D26525" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2652<wbr>5</a><br>
><br>
> Modified:<br>
>    llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineSelect.cpp<br>
>    llvm/trunk/test/Transforms/Ins<wbr>tCombine/adjust-for-minmax.ll<br>
>    llvm/trunk/test/Transforms/Ins<wbr>tCombine/div-shift.ll<br>
>    llvm/trunk/test/Transforms/Ins<wbr>tCombine/minmax-fold.ll<br>
>    llvm/trunk/test/Transforms/Ins<wbr>tCombine/pr27236.ll<br>
>    llvm/trunk/test/Transforms/Ins<wbr>tCombine/select_meta.ll<br>
>    llvm/trunk/test/Transforms/Ins<wbr>tCombine/sext.ll<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineSelect.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp?rev=287585&r1=287584&r2=287585&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/Transform<wbr>s/InstCombine/InstCombineSelec<wbr>t.cpp?rev=287585&r1=287584&r2=<wbr>287585&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineSelect.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineSelect.cpp Mon Nov 21 16:04:14 2016<br>
> @@ -500,9 +500,51 @@ static bool adjustMinMax(SelectInst &Sel<br>
>   return true;<br>
> }<br>
><br>
> +/// If this is an integer min/max where the select's 'true' operand is a<br>
> +/// constant, canonicalize that constant to the 'false' operand:<br>
> +/// select (icmp Pred X, C), C, X --> select (icmp Pred' X, C), X, C<br>
> +static Instruction *<br>
> +canonicalizeMinMaxWithConstan<wbr>t(SelectInst &Sel, ICmpInst &Cmp,<br>
> +                               InstCombiner::BuilderTy &Builder) {<br>
> +  // TODO: We should also canonicalize min/max when the select has a different<br>
> +  // constant value than the cmp constant, but we need to fix the backend first.<br>
> +  if (!Cmp.hasOneUse() || !isa<Constant>(Cmp.getOperand(<wbr>1)) ||<br>
> +      !isa<Constant>(Sel.getTrueValu<wbr>e()) ||<br>
> +      isa<Constant>(Sel.getFalseValu<wbr>e()) ||<br>
> +      Cmp.getOperand(1) != Sel.getTrueValue())<br>
> +    return nullptr;<br>
> +<br>
> +  // Canonicalize the compare predicate based on whether we have min or max.<br>
> +  Value *LHS, *RHS;<br>
> +  ICmpInst::Predicate NewPred;<br>
> +  SelectPatternResult SPR = matchSelectPattern(&Sel, LHS, RHS);<br>
> +  switch (SPR.Flavor) {<br>
> +  case SPF_SMIN: NewPred = ICmpInst::ICMP_SLT; break;<br>
> +  case SPF_UMIN: NewPred = ICmpInst::ICMP_ULT; break;<br>
> +  case SPF_SMAX: NewPred = ICmpInst::ICMP_SGT; break;<br>
> +  case SPF_UMAX: NewPred = ICmpInst::ICMP_UGT; break;<br>
> +  default: return nullptr;<br>
> +  }<br>
> +<br>
> +  // Canonicalize the constant to the right side.<br>
> +  if (isa<Constant>(LHS))<br>
> +    std::swap(LHS, RHS);<br>
> +<br>
> +  Value *NewCmp = Builder.CreateICmp(NewPred, LHS, RHS);<br>
> +  SelectInst *NewSel = SelectInst::Create(NewCmp, LHS, RHS);<br>
> +  NewSel->copyMetadata(Sel);<br>
> +<br>
> +  // We swapped the select operands, so swap the metadata too.<br>
> +  NewSel->swapProfMetadata();<br>
> +  return NewSel;<br>
> +}<br>
> +<br>
> /// Visit a SelectInst that has an ICmpInst as its first operand.<br>
> Instruction *InstCombiner::foldSelectInstW<wbr>ithICmp(SelectInst &SI,<br>
>                                                   ICmpInst *ICI) {<br>
> +  if (Instruction *NewSel = canonicalizeMinMaxWithConstant<wbr>(SI, *ICI, *Builder))<br>
> +    return NewSel;<br>
> +<br>
>   bool Changed = adjustMinMax(SI, *ICI);<br>
><br>
>   ICmpInst::Predicate Pred = ICI->getPredicate();<br>
><br>
> Modified: llvm/trunk/test/Transforms/Ins<wbr>tCombine/adjust-for-minmax.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/adjust-for-minmax.ll?rev=287585&r1=287584&r2=287585&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/Transfor<wbr>ms/InstCombine/adjust-for-minm<wbr>ax.ll?rev=287585&r1=287584&r2=<wbr>287585&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/test/Transforms/Ins<wbr>tCombine/adjust-for-minmax.ll (original)<br>
> +++ llvm/trunk/test/Transforms/Ins<wbr>tCombine/adjust-for-minmax.ll Mon Nov 21 16:04:14 2016<br>
> @@ -29,7 +29,7 @@ define i32 @smin1(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Canonicalize icmp predicate.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @smax2(i32 %n) {<br>
> ; CHECK-LABEL: @smax2(<br>
> @@ -42,7 +42,7 @@ define i32 @smax2(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Canonicalize icmp predicate.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @smin2(i32 %n) {<br>
> ; CHECK-LABEL: @smin2(<br>
> @@ -55,12 +55,12 @@ define i32 @smin2(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Swap signed pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @smax3(i32 %n) {<br>
> ; CHECK-LABEL: @smax3(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp slt i32 %n, 0<br>
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 0, i32 %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp sgt i32 %n, 0<br>
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 0<br>
> ; CHECK-NEXT:    ret i32 [[M]]<br>
> ;<br>
>   %t = icmp sgt i32 %n, -1<br>
> @@ -68,12 +68,12 @@ define i32 @smax3(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Swap vector signed pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define <2 x i32> @smax3_vec(<2 x i32> %n) {<br>
> ; CHECK-LABEL: @smax3_vec(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> %n, zeroinitializer<br>
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> zeroinitializer, <2 x i32> %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> %n, zeroinitializer<br>
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> zeroinitializer<br>
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br>
> ;<br>
>   %t = icmp sgt <2 x i32> %n, <i32 -1, i32 -1><br>
> @@ -81,12 +81,12 @@ define <2 x i32> @smax3_vec(<2 x i32> %n<br>
>   ret <2 x i32> %m<br>
> }<br>
><br>
> -; Swap signed pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @smin3(i32 %n) {<br>
> ; CHECK-LABEL: @smin3(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp sgt i32 %n, 0<br>
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 0, i32 %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp slt i32 %n, 0<br>
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 0<br>
> ; CHECK-NEXT:    ret i32 [[M]]<br>
> ;<br>
>   %t = icmp slt i32 %n, 1<br>
> @@ -94,12 +94,12 @@ define i32 @smin3(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Swap vector signed pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define <2 x i32> @smin3_vec(<2 x i32> %n) {<br>
> ; CHECK-LABEL: @smin3_vec(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> %n, zeroinitializer<br>
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> zeroinitializer, <2 x i32> %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> %n, zeroinitializer<br>
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> zeroinitializer<br>
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br>
> ;<br>
>   %t = icmp slt <2 x i32> %n, <i32 1, i32 1><br>
> @@ -107,12 +107,12 @@ define <2 x i32> @smin3_vec(<2 x i32> %n<br>
>   ret <2 x i32> %m<br>
> }<br>
><br>
> -; Swap unsigned pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @umax3(i32 %n) {<br>
> ; CHECK-LABEL: @umax3(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 %n, 5<br>
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 5, i32 %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp ugt i32 %n, 5<br>
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 5<br>
> ; CHECK-NEXT:    ret i32 [[M]]<br>
> ;<br>
>   %t = icmp ugt i32 %n, 4<br>
> @@ -120,12 +120,12 @@ define i32 @umax3(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Swap vector unsigned pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define <2 x i32> @umax3_vec(<2 x i32> %n) {<br>
> ; CHECK-LABEL: @umax3_vec(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> %n, <i32 5, i32 5><br>
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> <i32 5, i32 5>, <2 x i32> %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> %n, <i32 5, i32 5><br>
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> <i32 5, i32 5><br>
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br>
> ;<br>
>   %t = icmp ugt <2 x i32> %n, <i32 4, i32 4><br>
> @@ -133,12 +133,12 @@ define <2 x i32> @umax3_vec(<2 x i32> %n<br>
>   ret <2 x i32> %m<br>
> }<br>
><br>
> -; Swap unsigned pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @umin3(i32 %n) {<br>
> ; CHECK-LABEL: @umin3(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp ugt i32 %n, 6<br>
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 6, i32 %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 %n, 6<br>
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 6<br>
> ; CHECK-NEXT:    ret i32 [[M]]<br>
> ;<br>
>   %t = icmp ult i32 %n, 7<br>
> @@ -146,12 +146,12 @@ define i32 @umin3(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Swap vector unsigned pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define <2 x i32> @umin3_vec(<2 x i32> %n) {<br>
> ; CHECK-LABEL: @umin3_vec(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> %n, <i32 6, i32 6><br>
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> <i32 6, i32 6>, <2 x i32> %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> %n, <i32 6, i32 6><br>
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> <i32 6, i32 6><br>
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br>
> ;<br>
>   %t = icmp ult <2 x i32> %n, <i32 7, i32 7><br>
> @@ -159,12 +159,12 @@ define <2 x i32> @umin3_vec(<2 x i32> %n<br>
>   ret <2 x i32> %m<br>
> }<br>
><br>
> -; Canonicalize signed pred and swap pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @smax4(i32 %n) {<br>
> ; CHECK-LABEL: @smax4(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp slt i32 %n, 0<br>
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 0, i32 %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp sgt i32 %n, 0<br>
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 0<br>
> ; CHECK-NEXT:    ret i32 [[M]]<br>
> ;<br>
>   %t = icmp sge i32 %n, 0<br>
> @@ -172,12 +172,12 @@ define i32 @smax4(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Canonicalize vector signed pred and swap pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define <2 x i32> @smax4_vec(<2 x i32> %n) {<br>
> ; CHECK-LABEL: @smax4_vec(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> %n, zeroinitializer<br>
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> zeroinitializer, <2 x i32> %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> %n, zeroinitializer<br>
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> zeroinitializer<br>
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br>
> ;<br>
>   %t = icmp sge <2 x i32> %n, zeroinitializer<br>
> @@ -185,12 +185,12 @@ define <2 x i32> @smax4_vec(<2 x i32> %n<br>
>   ret <2 x i32> %m<br>
> }<br>
><br>
> -; Canonicalize signed pred and swap pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @smin4(i32 %n) {<br>
> ; CHECK-LABEL: @smin4(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp sgt i32 %n, 0<br>
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 0, i32 %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp slt i32 %n, 0<br>
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 0<br>
> ; CHECK-NEXT:    ret i32 [[M]]<br>
> ;<br>
>   %t = icmp sle i32 %n, 0<br>
> @@ -198,12 +198,12 @@ define i32 @smin4(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Canonicalize vector signed pred and swap pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define <2 x i32> @smin4_vec(<2 x i32> %n) {<br>
> ; CHECK-LABEL: @smin4_vec(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> %n, zeroinitializer<br>
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> zeroinitializer, <2 x i32> %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> %n, zeroinitializer<br>
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> zeroinitializer<br>
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br>
> ;<br>
>   %t = icmp sle <2 x i32> %n, zeroinitializer<br>
> @@ -211,12 +211,12 @@ define <2 x i32> @smin4_vec(<2 x i32> %n<br>
>   ret <2 x i32> %m<br>
> }<br>
><br>
> -; Canonicalize unsigned pred and swap pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @umax4(i32 %n) {<br>
> ; CHECK-LABEL: @umax4(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 %n, 8<br>
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 8, i32 %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp ugt i32 %n, 8<br>
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 8<br>
> ; CHECK-NEXT:    ret i32 [[M]]<br>
> ;<br>
>   %t = icmp uge i32 %n, 8<br>
> @@ -224,12 +224,12 @@ define i32 @umax4(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Canonicalize vector unsigned pred and swap pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define <2 x i32> @umax4_vec(<2 x i32> %n) {<br>
> ; CHECK-LABEL: @umax4_vec(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> %n, <i32 8, i32 8><br>
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> <i32 8, i32 8>, <2 x i32> %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> %n, <i32 8, i32 8><br>
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> <i32 8, i32 8><br>
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br>
> ;<br>
>   %t = icmp uge <2 x i32> %n, <i32 8, i32 8><br>
> @@ -237,12 +237,12 @@ define <2 x i32> @umax4_vec(<2 x i32> %n<br>
>   ret <2 x i32> %m<br>
> }<br>
><br>
> -; Canonicalize unsigned pred and swap pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define i32 @umin4(i32 %n) {<br>
> ; CHECK-LABEL: @umin4(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp ugt i32 %n, 9<br>
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 9, i32 %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 %n, 9<br>
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 9<br>
> ; CHECK-NEXT:    ret i32 [[M]]<br>
> ;<br>
>   %t = icmp ule i32 %n, 9<br>
> @@ -250,12 +250,12 @@ define i32 @umin4(i32 %n) {<br>
>   ret i32 %m<br>
> }<br>
><br>
> -; Canonicalize vector unsigned pred and swap pred and select ops.<br>
> +; Canonicalize min/max.<br>
><br>
> define <2 x i32> @umin4_vec(<2 x i32> %n) {<br>
> ; CHECK-LABEL: @umin4_vec(<br>
> -; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> %n, <i32 9, i32 9><br>
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> <i32 9, i32 9>, <2 x i32> %n<br>
> +; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> %n, <i32 9, i32 9><br>
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> <i32 9, i32 9><br>
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br>
> ;<br>
>   %t = icmp ule <2 x i32> %n, <i32 9, i32 9><br>
> @@ -266,8 +266,8 @@ define <2 x i32> @umin4_vec(<2 x i32> %n<br>
> define i64 @smax_sext(i32 %a) {<br>
> ; CHECK-LABEL: @smax_sext(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i64 [[A_EXT]], 0<br>
> -; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 0, i64 [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i64 [[A_EXT]], 0<br>
> +; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 0<br>
> ; CHECK-NEXT:    ret i64 [[MAX]]<br>
> ;<br>
>   %a_ext = sext i32 %a to i64<br>
> @@ -279,8 +279,8 @@ define i64 @smax_sext(i32 %a) {<br>
> define <2 x i64> @smax_sext_vec(<2 x i32> %a) {<br>
> ; CHECK-LABEL: @smax_sext_vec(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext <2 x i32> %a to <2 x i64><br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt <2 x i64> [[A_EXT]], zeroinitializer<br>
> -; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> zeroinitializer, <2 x i64> [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i64> [[A_EXT]], zeroinitializer<br>
> +; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> zeroinitializer<br>
> ; CHECK-NEXT:    ret <2 x i64> [[MAX]]<br>
> ;<br>
>   %a_ext = sext <2 x i32> %a to <2 x i64><br>
> @@ -292,8 +292,8 @@ define <2 x i64> @smax_sext_vec(<2 x i32<br>
> define i64 @smin_sext(i32 %a) {<br>
> ; CHECK-LABEL: @smin_sext(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i64 [[A_EXT]], 0<br>
> -; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 0, i64 [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i64 [[A_EXT]], 0<br>
> +; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 0<br>
> ; CHECK-NEXT:    ret i64 [[MIN]]<br>
> ;<br>
>   %a_ext = sext i32 %a to i64<br>
> @@ -305,8 +305,8 @@ define i64 @smin_sext(i32 %a) {<br>
> define <2 x i64>@smin_sext_vec(<2 x i32> %a) {<br>
> ; CHECK-LABEL: @smin_sext_vec(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext <2 x i32> %a to <2 x i64><br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i64> [[A_EXT]], zeroinitializer<br>
> -; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> zeroinitializer, <2 x i64> [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt <2 x i64> [[A_EXT]], zeroinitializer<br>
> +; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> zeroinitializer<br>
> ; CHECK-NEXT:    ret <2 x i64> [[MIN]]<br>
> ;<br>
>   %a_ext = sext <2 x i32> %a to <2 x i64><br>
> @@ -318,8 +318,8 @@ define <2 x i64>@smin_sext_vec(<2 x i32><br>
> define i64 @umax_sext(i32 %a) {<br>
> ; CHECK-LABEL: @umax_sext(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[A_EXT]], 3<br>
> -; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 3, i64 [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i64 [[A_EXT]], 3<br>
> +; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 3<br>
> ; CHECK-NEXT:    ret i64 [[MAX]]<br>
> ;<br>
>   %a_ext = sext i32 %a to i64<br>
> @@ -331,8 +331,8 @@ define i64 @umax_sext(i32 %a) {<br>
> define <2 x i64> @umax_sext_vec(<2 x i32> %a) {<br>
> ; CHECK-LABEL: @umax_sext_vec(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext <2 x i32> %a to <2 x i64><br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i64> [[A_EXT]], <i64 3, i64 3><br>
> -; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> <i64 3, i64 3>, <2 x i64> [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i64> [[A_EXT]], <i64 3, i64 3><br>
> +; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> <i64 3, i64 3><br>
> ; CHECK-NEXT:    ret <2 x i64> [[MAX]]<br>
> ;<br>
>   %a_ext = sext <2 x i32> %a to <2 x i64><br>
> @@ -344,8 +344,8 @@ define <2 x i64> @umax_sext_vec(<2 x i32<br>
> define i64 @umin_sext(i32 %a) {<br>
> ; CHECK-LABEL: @umin_sext(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i64 [[A_EXT]], 2<br>
> -; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 2, i64 [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[A_EXT]], 2<br>
> +; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 2<br>
> ; CHECK-NEXT:    ret i64 [[MIN]]<br>
> ;<br>
>   %a_ext = sext i32 %a to i64<br>
> @@ -357,8 +357,8 @@ define i64 @umin_sext(i32 %a) {<br>
> define <2 x i64> @umin_sext_vec(<2 x i32> %a) {<br>
> ; CHECK-LABEL: @umin_sext_vec(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext <2 x i32> %a to <2 x i64><br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i64> [[A_EXT]], <i64 2, i64 2><br>
> -; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> <i64 2, i64 2>, <2 x i64> [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i64> [[A_EXT]], <i64 2, i64 2><br>
> +; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> <i64 2, i64 2><br>
> ; CHECK-NEXT:    ret <2 x i64> [[MIN]]<br>
> ;<br>
>   %a_ext = sext <2 x i32> %a to <2 x i64><br>
> @@ -422,8 +422,8 @@ define <2 x i64> @umin_sext2_vec(<2 x i3<br>
> define i64 @umax_zext(i32 %a) {<br>
> ; CHECK-LABEL: @umax_zext(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = zext i32 %a to i64<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[A_EXT]], 3<br>
> -; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 3, i64 [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i64 [[A_EXT]], 3<br>
> +; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 3<br>
> ; CHECK-NEXT:    ret i64 [[MAX]]<br>
> ;<br>
>   %a_ext = zext i32 %a to i64<br>
> @@ -435,8 +435,8 @@ define i64 @umax_zext(i32 %a) {<br>
> define <2 x i64> @umax_zext_vec(<2 x i32> %a) {<br>
> ; CHECK-LABEL: @umax_zext_vec(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = zext <2 x i32> %a to <2 x i64><br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i64> [[A_EXT]], <i64 3, i64 3><br>
> -; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> <i64 3, i64 3>, <2 x i64> [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i64> [[A_EXT]], <i64 3, i64 3><br>
> +; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> <i64 3, i64 3><br>
> ; CHECK-NEXT:    ret <2 x i64> [[MAX]]<br>
> ;<br>
>   %a_ext = zext <2 x i32> %a to <2 x i64><br>
> @@ -448,8 +448,8 @@ define <2 x i64> @umax_zext_vec(<2 x i32<br>
> define i64 @umin_zext(i32 %a) {<br>
> ; CHECK-LABEL: @umin_zext(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = zext i32 %a to i64<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i64 [[A_EXT]], 2<br>
> -; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 2, i64 [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[A_EXT]], 2<br>
> +; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 2<br>
> ; CHECK-NEXT:    ret i64 [[MIN]]<br>
> ;<br>
>   %a_ext = zext i32 %a to i64<br>
> @@ -461,8 +461,8 @@ define i64 @umin_zext(i32 %a) {<br>
> define <2 x i64> @umin_zext_vec(<2 x i32> %a) {<br>
> ; CHECK-LABEL: @umin_zext_vec(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = zext <2 x i32> %a to <2 x i64><br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i64> [[A_EXT]], <i64 2, i64 2><br>
> -; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> <i64 2, i64 2>, <2 x i64> [[A_EXT]]<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i64> [[A_EXT]], <i64 2, i64 2><br>
> +; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> <i64 2, i64 2><br>
> ; CHECK-NEXT:    ret <2 x i64> [[MIN]]<br>
> ;<br>
>   %a_ext = zext <2 x i32> %a to <2 x i64><br>
><br>
> Modified: llvm/trunk/test/Transforms/Ins<wbr>tCombine/div-shift.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/div-shift.ll?rev=287585&r1=287584&r2=287585&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/Transfor<wbr>ms/InstCombine/div-shift.ll?re<wbr>v=287585&r1=287584&r2=287585&v<wbr>iew=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/test/Transforms/Ins<wbr>tCombine/div-shift.ll (original)<br>
> +++ llvm/trunk/test/Transforms/Ins<wbr>tCombine/div-shift.ll Mon Nov 21 16:04:14 2016<br>
> @@ -45,8 +45,8 @@ define i64 @t3(i64 %x, i32 %y) {<br>
><br>
> define i32 @t4(i32 %x, i32 %y) {<br>
> ; CHECK-LABEL: @t4(<br>
> -; CHECK-NEXT:    [[TMP1:%.*]] = icmp ult i32 %y, 5<br>
> -; CHECK-NEXT:    [[DOTV:%.*]] = select i1 [[TMP1]], i32 5, i32 %y<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt i32 %y, 5<br>
> +; CHECK-NEXT:    [[DOTV:%.*]] = select i1 [[TMP1]], i32 %y, i32 5<br>
> ; CHECK-NEXT:    [[TMP2:%.*]] = lshr i32 %x, [[DOTV]]<br>
> ; CHECK-NEXT:    ret i32 [[TMP2]]<br>
> ;<br>
><br>
> Modified: llvm/trunk/test/Transforms/Ins<wbr>tCombine/minmax-fold.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll?rev=287585&r1=287584&r2=287585&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/Transfor<wbr>ms/InstCombine/minmax-fold.ll?<wbr>rev=287585&r1=287584&r2=287585<wbr>&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/test/Transforms/Ins<wbr>tCombine/minmax-fold.ll (original)<br>
> +++ llvm/trunk/test/Transforms/Ins<wbr>tCombine/minmax-fold.ll Mon Nov 21 16:04:14 2016<br>
> @@ -200,8 +200,8 @@ define <4 x float> @bitcasts_icmp(<2 x i<br>
> ; SMIN(SMIN(X, 11), 92) -> SMIN(X, 11)<br>
> define i32 @test68(i32 %x) {<br>
> ; CHECK-LABEL: @test68(<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, 11<br>
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 11, i32 %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 %x, 11<br>
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 11<br>
> ; CHECK-NEXT:    ret i32 [[COND]]<br>
> ;<br>
>   %cmp = icmp slt i32 11, %x<br>
> @@ -213,8 +213,8 @@ define i32 @test68(i32 %x) {<br>
><br>
> define <2 x i32> @test68vec(<2 x i32> %x) {<br>
> ; CHECK-LABEL: @test68vec(<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 11, i32 11><br>
> -; CHECK-NEXT:    [[COND:%.*]] = select <2 x i1> [[CMP]], <2 x i32> <i32 11, i32 11>, <2 x i32> %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt <2 x i32> %x, <i32 11, i32 11><br>
> +; CHECK-NEXT:    [[COND:%.*]] = select <2 x i1> [[TMP1]], <2 x i32> %x, <2 x i32> <i32 11, i32 11><br>
> ; CHECK-NEXT:    ret <2 x i32> [[COND]]<br>
> ;<br>
>   %cmp = icmp slt <2 x i32> <i32 11, i32 11>, %x<br>
> @@ -227,8 +227,8 @@ define <2 x i32> @test68vec(<2 x i32> %x<br>
> ; MIN(MIN(X, 24), 83) -> MIN(X, 24)<br>
> define i32 @test69(i32 %x) {<br>
> ; CHECK-LABEL: @test69(<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i32 %x, 24<br>
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 24, i32 %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ult i32 %x, 24<br>
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 24<br>
> ; CHECK-NEXT:    ret i32 [[COND]]<br>
> ;<br>
>   %cmp = icmp ult i32 24, %x<br>
> @@ -241,8 +241,8 @@ define i32 @test69(i32 %x) {<br>
> ; SMAX(SMAX(X, 75), 36) -> SMAX(X, 75)<br>
> define i32 @test70(i32 %x) {<br>
> ; CHECK-LABEL: @test70(<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 75<br>
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 75, i32 %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %x, 75<br>
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 75<br>
> ; CHECK-NEXT:    ret i32 [[COND]]<br>
> ;<br>
>   %cmp = icmp slt i32 %x, 75<br>
> @@ -255,8 +255,8 @@ define i32 @test70(i32 %x) {<br>
> ; MAX(MAX(X, 68), 47) -> MAX(X, 68)<br>
> define i32 @test71(i32 %x) {<br>
> ; CHECK-LABEL: @test71(<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 %x, 68<br>
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 68, i32 %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt i32 %x, 68<br>
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 68<br>
> ; CHECK-NEXT:    ret i32 [[COND]]<br>
> ;<br>
>   %cmp = icmp ult i32 %x, 68<br>
> @@ -269,8 +269,8 @@ define i32 @test71(i32 %x) {<br>
> ; SMIN(SMIN(X, 92), 11) -> SMIN(X, 11)<br>
> define i32 @test72(i32 %x) {<br>
> ; CHECK-LABEL: @test72(<br>
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt i32 %x, 11<br>
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 11, i32 %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 %x, 11<br>
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 11<br>
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br>
> ;<br>
>   %cmp = icmp sgt i32 %x, 92<br>
> @@ -280,14 +280,14 @@ define i32 @test72(i32 %x) {<br>
>   ret i32 %retval<br>
> }<br>
><br>
> -; FIXME - vector neglect: FoldOrOfICmps()<br>
> +; FIXME - vector neglect: FoldAndOfICmps() / FoldOrOfICmps()<br>
><br>
> define <2 x i32> @test72vec(<2 x i32> %x) {<br>
> ; CHECK-LABEL: @test72vec(<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 92, i32 92><br>
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt <2 x i32> %x, <i32 11, i32 11><br>
> -; CHECK-NEXT:    [[CMP3:%.*]] = or <2 x i1> [[CMP]], [[CMP31:%.*]]<br>
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select <2 x i1> [[CMP3]], <2 x i32> <i32 11, i32 11>, <2 x i32> %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt <2 x i32> %x, <i32 92, i32 92><br>
> +; CHECK-NEXT:    [[TMP2:%.*]] = icmp slt <2 x i32> %x, <i32 11, i32 11><br>
> +; CHECK-NEXT:    [[TMP3:%.*]] = and <2 x i1> [[TMP1]], [[TMP2]]<br>
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select <2 x i1> [[TMP3]], <2 x i32> %x, <2 x i32> <i32 11, i32 11><br>
> ; CHECK-NEXT:    ret <2 x i32> [[RETVAL]]<br>
> ;<br>
>   %cmp = icmp sgt <2 x i32> %x, <i32 92, i32 92><br>
> @@ -300,8 +300,8 @@ define <2 x i32> @test72vec(<2 x i32> %x<br>
> ; MIN(MIN(X, 83), 24) -> MIN(X, 24)<br>
> define i32 @test73(i32 %x) {<br>
> ; CHECK-LABEL: @test73(<br>
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp ugt i32 %x, 24<br>
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 24, i32 %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ult i32 %x, 24<br>
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 24<br>
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br>
> ;<br>
>   %cmp = icmp ugt i32 %x, 83<br>
> @@ -314,8 +314,8 @@ define i32 @test73(i32 %x) {<br>
> ; SMAX(SMAX(X, 36), 75) -> SMAX(X, 75)<br>
> define i32 @test74(i32 %x) {<br>
> ; CHECK-LABEL: @test74(<br>
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp slt i32 %x, 75<br>
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 75, i32 %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %x, 75<br>
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 75<br>
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br>
> ;<br>
>   %cmp = icmp slt i32 %x, 36<br>
> @@ -328,8 +328,8 @@ define i32 @test74(i32 %x) {<br>
> ; MAX(MAX(X, 47), 68) -> MAX(X, 68)<br>
> define i32 @test75(i32 %x) {<br>
> ; CHECK-LABEL: @test75(<br>
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp ult i32 %x, 68<br>
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 68, i32 %x<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt i32 %x, 68<br>
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 68<br>
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br>
> ;<br>
>   %cmp = icmp ult i32 %x, 47<br>
><br>
> Modified: llvm/trunk/test/Transforms/Ins<wbr>tCombine/pr27236.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pr27236.ll?rev=287585&r1=287584&r2=287585&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/Transfor<wbr>ms/InstCombine/pr27236.ll?rev=<wbr>287585&r1=287584&r2=287585&vie<wbr>w=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/test/Transforms/Ins<wbr>tCombine/pr27236.ll (original)<br>
> +++ llvm/trunk/test/Transforms/Ins<wbr>tCombine/pr27236.ll Mon Nov 21 16:04:14 2016<br>
> @@ -3,8 +3,8 @@<br>
><br>
> define float @test1(i32 %scale) {<br>
> ; CHECK-LABEL: @test1(<br>
> -; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 %scale, 1<br>
> -; CHECK-NEXT:    [[TMP2:%.*]] = select i1 [[TMP1]], i32 1, i32 %scale<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %scale, 1<br>
> +; CHECK-NEXT:    [[TMP2:%.*]] = select i1 [[TMP1]], i32 %scale, i32 1<br>
> ; CHECK-NEXT:    [[TMP3:%.*]] = sitofp i32 [[TMP2]] to float<br>
> ; CHECK-NEXT:    [[TMP4:%.*]] = icmp sgt i32 [[TMP2]], 0<br>
> ; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[TMP4]], float [[TMP3]], float 0.000000e+00<br>
><br>
> Modified: llvm/trunk/test/Transforms/Ins<wbr>tCombine/select_meta.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select_meta.ll?rev=287585&r1=287584&r2=287585&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/Transfor<wbr>ms/InstCombine/select_meta.ll?<wbr>rev=287585&r1=287584&r2=287585<wbr>&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/test/Transforms/Ins<wbr>tCombine/select_meta.ll (original)<br>
> +++ llvm/trunk/test/Transforms/Ins<wbr>tCombine/select_meta.ll Mon Nov 21 16:04:14 2016<br>
> @@ -1,4 +1,6 @@<br>
> -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py and enhanced to include metadata checking.<br>
> +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py<br>
> +; and enhanced to include metadata checking.<br>
> +<br>
> ; RUN: opt < %s -instcombine -S | FileCheck %s<br>
><br>
> define i32 @foo(i32) local_unnamed_addr #0  {<br>
> @@ -51,12 +53,11 @@ define i32 @foo2(i32, i32) local_unnamed<br>
>   ret i32 %6<br>
> }<br>
><br>
> -; condition swapped<br>
> define i64 @test43(i32 %a) nounwind {<br>
> ; CHECK-LABEL: @test43(<br>
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br>
> -; CHECK-NEXT:    [[IS_A_NONNEGATIVE:%.*]] = icmp slt i64 [[A_EXT]], 0<br>
> -; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[IS_A_NONNEGATIVE]], i64 0, i64 [[A_EXT]], !prof ![[MD3:[0-9]+]]<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i64 [[A_EXT]], 0<br>
> +; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[TMP1]], i64 [[A_EXT]], i64 0, !prof ![[MD1]]<br>
> ; CHECK-NEXT:    ret i64 [[MAX]]<br>
> ;<br>
>   %a_ext = sext i32 %a to i64<br>
> @@ -136,10 +137,12 @@ define i32 @test30(i32 %x, i32 %y) {<br>
>   ret i32 %retval<br>
> }<br>
><br>
> +; Swap predicate / metadata order<br>
> +; SMAX(SMAX(X, 75), 36) -> SMAX(X, 75)<br>
> define i32 @test70(i32 %x) {<br>
> ; CHECK-LABEL: @test70(<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 75<br>
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 75, i32 %x, !prof ![[MD1]]<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %x, 75<br>
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 75, !prof ![[MD3:[0-9]+]]<br>
> ; CHECK-NEXT:    ret i32 [[COND]]<br>
> ;<br>
>   %cmp = icmp slt i32 %x, 75<br>
> @@ -149,12 +152,12 @@ define i32 @test70(i32 %x) {<br>
>   ret i32 %retval<br>
> }<br>
><br>
> -<br>
> +; Swap predicate / metadata order<br>
> ; SMIN(SMIN(X, 92), 11) -> SMIN(X, 11)<br>
> define i32 @test72(i32 %x) {<br>
> ; CHECK-LABEL: @test72(<br>
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt i32 %x, 11<br>
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 11, i32 %x, !prof ![[MD2:[0-9]+]]<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 %x, 11<br>
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 11, !prof ![[MD4:[0-9]+]]<br>
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br>
> ;<br>
>   %cmp = icmp sgt i32 %x, 92<br>
> @@ -164,11 +167,12 @@ define i32 @test72(i32 %x) {<br>
>   ret i32 %retval<br>
> }<br>
><br>
> +; Swap predicate / metadata order<br>
> ; SMAX(SMAX(X, 36), 75) -> SMAX(X, 75)<br>
> define i32 @test74(i32 %x) {<br>
> ; CHECK-LABEL: @test74(<br>
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp slt i32 %x, 75<br>
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 75, i32 %x, !prof ![[MD2]]<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %x, 75<br>
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 75, !prof ![[MD4]]<br>
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br>
> ;<br>
>   %cmp = icmp slt i32 %x, 36<br>
> @@ -178,10 +182,122 @@ define i32 @test74(i32 %x) {<br>
>   ret i32 %retval<br>
> }<br>
><br>
> +; FIXME:<br>
> +; The compare should change, but the metadata remains the same because the select operands are not swapped.<br>
> +define i32 @smin1(i32 %x) {<br>
> +; CHECK-LABEL: @smin1(<br>
> +; CHECK-NEXT:    [[NOT_X:%.*]] = xor i32 %x, -1<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, 0<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 [[NOT_X]], i32 -1, !prof ![[MD1]]<br>
> +; CHECK-NEXT:    ret i32 [[SEL]]<br>
> +;<br>
> +  %not_x = xor i32 %x, -1<br>
> +  %cmp = icmp sgt i32 %x, 0<br>
> +  %sel = select i1 %cmp, i32 %not_x, i32 -1, !prof !1<br>
> +  ret i32 %sel<br>
> +}<br>
> +<br>
> +; FIXME:<br>
> +; The compare should change, and the metadata is swapped because the select operands are swapped.<br>
> +define i32 @smin2(i32 %x) {<br>
> +; CHECK-LABEL: @smin2(<br>
> +; CHECK-NEXT:    [[NOT_X:%.*]] = xor i32 %x, -1<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 0<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 -1, i32 [[NOT_X]], !prof ![[MD1]]<br>
> +; CHECK-NEXT:    ret i32 [[SEL]]<br>
> +;<br>
> +  %not_x = xor i32 %x, -1<br>
> +  %cmp = icmp slt i32 %x, 0<br>
> +  %sel = select i1 %cmp, i32 -1, i32 %not_x, !prof !1<br>
> +  ret i32 %sel<br>
> +}<br>
> +<br>
> +; FIXME:<br>
> +; The compare should change, but the metadata remains the same because the select operands are not swapped.<br>
> +define i32 @smax1(i32 %x) {<br>
> +; CHECK-LABEL: @smax1(<br>
> +; CHECK-NEXT:    [[NOT_X:%.*]] = xor i32 %x, -1<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 0<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 [[NOT_X]], i32 -1, !prof ![[MD1]]<br>
> +; CHECK-NEXT:    ret i32 [[SEL]]<br>
> +;<br>
> +  %not_x = xor i32 %x, -1<br>
> +  %cmp = icmp slt i32 %x, 0<br>
> +  %sel = select i1 %cmp, i32 %not_x, i32 -1, !prof !1<br>
> +  ret i32 %sel<br>
> +}<br>
> +<br>
> +; FIXME:<br>
> +; The compare should change, and the metadata is swapped because the select operands are swapped.<br>
> +define i32 @smax2(i32 %x) {<br>
> +; CHECK-LABEL: @smax2(<br>
> +; CHECK-NEXT:    [[NOT_X:%.*]] = xor i32 %x, -1<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, 0<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 -1, i32 [[NOT_X]], !prof ![[MD1]]<br>
> +; CHECK-NEXT:    ret i32 [[SEL]]<br>
> +;<br>
> +  %not_x = xor i32 %x, -1<br>
> +  %cmp = icmp sgt i32 %x, 0<br>
> +  %sel = select i1 %cmp, i32 -1, i32 %not_x, !prof !1<br>
> +  ret i32 %sel<br>
> +}<br>
> +<br>
> +; FIXME:<br>
> +; The compare should change, but the metadata remains the same because the select operands are not swapped.<br>
> +define i32 @umin1(i32 %x) {<br>
> +; CHECK-LABEL: @umin1(<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, -1<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 %x, i32 -<a href="tel:2147483648" value="+12147483648" target="_blank">2147483648</a>, !prof ![[MD1]]<br>
> +; CHECK-NEXT:    ret i32 [[SEL]]<br>
> +;<br>
> +  %cmp = icmp sgt i32 %x, -1<br>
> +  %sel = select i1 %cmp, i32 %x, i32 -<a href="tel:2147483648" value="+12147483648" target="_blank">2147483648</a>, !prof !1<br>
> +  ret i32 %sel<br>
> +}<br>
> +<br>
> +; FIXME:<br>
> +; The compare should change, and the metadata is swapped because the select operands are swapped.<br>
> +define i32 @umin2(i32 %x) {<br>
> +; CHECK-LABEL: @umin2(<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 0<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 <a href="tel:2147483647" value="+12147483647" target="_blank">2147483647</a>, i32 %x, !prof ![[MD1]]<br>
> +; CHECK-NEXT:    ret i32 [[SEL]]<br>
> +;<br>
> +  %cmp = icmp slt i32 %x, 0<br>
> +  %sel = select i1 %cmp, i32 <a href="tel:2147483647" value="+12147483647" target="_blank">2147483647</a>, i32 %x, !prof !1<br>
> +  ret i32 %sel<br>
> +}<br>
> +<br>
> +; FIXME:<br>
> +; The compare should change, but the metadata remains the same because the select operands are not swapped.<br>
> +define i32 @umax1(i32 %x) {<br>
> +; CHECK-LABEL: @umax1(<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 0<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 %x, i32 <a href="tel:2147483647" value="+12147483647" target="_blank">2147483647</a>, !prof ![[MD1]]<br>
> +; CHECK-NEXT:    ret i32 [[SEL]]<br>
> +;<br>
> +  %cmp = icmp slt i32 %x, 0<br>
> +  %sel = select i1 %cmp, i32 %x, i32 <a href="tel:2147483647" value="+12147483647" target="_blank">2147483647</a>, !prof !1<br>
> +  ret i32 %sel<br>
> +}<br>
> +<br>
> +; FIXME:<br>
> +; The compare should change, and the metadata is swapped because the select operands are swapped.<br>
> +define i32 @umax2(i32 %x) {<br>
> +; CHECK-LABEL: @umax2(<br>
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, -1<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 -<a href="tel:2147483648" value="+12147483648" target="_blank">2147483648</a>, i32 %x, !prof ![[MD1]]<br>
> +; CHECK-NEXT:    ret i32 [[SEL]]<br>
> +;<br>
> +  %cmp = icmp sgt i32 %x, -1<br>
> +  %sel = select i1 %cmp, i32 -<a href="tel:2147483648" value="+12147483648" target="_blank">2147483648</a>, i32 %x, !prof !1<br>
> +  ret i32 %sel<br>
> +}<br>
> +<br>
> !1 = !{!"branch_weights", i32 2, i32 10}<br>
> !2 = !{!"branch_weights", i32 3, i32 10}<br>
><br>
> ; CHECK-DAG: ![[MD1]] = !{!"branch_weights", i32 2, i32 10}<br>
> -; CHECK-DAG: ![[MD2]] = !{!"branch_weights", i32 3, i32 10}<br>
> ; CHECK-DAG: ![[MD3]] = !{!"branch_weights", i32 10, i32 2}<br>
> +; CHECK-DAG: ![[MD4]] = !{!"branch_weights", i32 10, i32 3}<br>
><br>
><br>
> Modified: llvm/trunk/test/Transforms/Ins<wbr>tCombine/sext.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sext.ll?rev=287585&r1=287584&r2=287585&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/Transfor<wbr>ms/InstCombine/sext.ll?rev=287<wbr>585&r1=287584&r2=287585&view=d<wbr>iff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/test/Transforms/Ins<wbr>tCombine/sext.ll (original)<br>
> +++ llvm/trunk/test/Transforms/Ins<wbr>tCombine/sext.ll Mon Nov 21 16:04:14 2016<br>
> @@ -229,10 +229,10 @@ define i32 @test17(i1 %x) {<br>
><br>
> define i32 @test18(i16 %x) {<br>
> ; CHECK-LABEL: @test18(<br>
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i16 %x, 0<br>
> -; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i16 0, i16 %x<br>
> -; CHECK-NEXT:    [[TMP1:%.*]] = zext i16 [[SEL]] to i32<br>
> -; CHECK-NEXT:    ret i32 [[TMP1]]<br>
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i16 %x, 0<br>
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[TMP1]], i16 %x, i16 0<br>
> +; CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[SEL]] to i32<br>
> +; CHECK-NEXT:    ret i32 [[TMP2]]<br>
> ;<br>
>   %cmp = icmp slt i16 %x, 0<br>
>   %sel = select i1 %cmp, i16 0, i16 %x<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
<br>
<br></blockquote></div><br></div></div>
</div></blockquote></div><br></div></div></div></blockquote></div><br></div></div></div>