<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">%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><div class=""><br class=""></div><div class="">Volkan</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 1, 2016, at 6:50 PM, Sanjay Patel <<a href="mailto:spatel@rotateright.com" class="">spatel@rotateright.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class="">Hi Volkan,<br class=""><br class=""></div>I didn't look at the attachment yet, but let me make sure that I'm understanding the problem.<br class=""></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 class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Dec 1, 2016 at 11:30 AM, Volkan Keles <span dir="ltr" class=""><<a href="mailto:vkeles@apple.com" target="_blank" class="">vkeles@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sanjay,<br class="">
<br class="">
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 class="">
<br class="">
We have:<br class="">
%tmp11 = phi i32 [ 0, %bb ], [ %tmp14, %for.inc.73 ]<br class="">
%cmp31 = icmp sgt i32 %tmp11, 20<br class="">
%tmp14 = select i1 %cmp31, i32 20, i32 %tmp11<br class="">
<br class="">
Here, it tries to simplify the comparison instruction by checking if comparing all the incoming values yields the same value.<br class="">
SimplifyCmpInst(ICMP_SGT, i32 0, i32 20, ...) = i1 false<br class="">
SimplifyCmpInst(ICMP_SGT, %tmp14, i32 20, …) = i1 false<br class="">
<br class="">
If we canonicalize min/max with constant, the instructions will be as below.<br class="">
%tmp11 = phi i32 [ 0, %bb ], [ %tmp14, %for.inc.73 ]<br class="">
%0 = icmp slt i32 %tmp11, 20<br class="">
%tmp14 = select i1 %0, i32 %tmp11, i32 20<br class="">
<br class="">
If we try the same simplification with these instructions, the second call yields the comparison instruction.<br class="">
SimplifyCmpInst(ICMP_SLT, i32 0, i32 20, …) = i1 true<br class="">
SimplifyCmpInst(ICMP_SLT, %tmp14, i32 20, …) = %0 = icmp slt i32 %tmp11, 20<br class="">
<br class="">
Thank you,<br class="">
Volkan<br class="">
<br class="">
<br class=""><br class="">
> On Nov 21, 2016, at 10:04 PM, Sanjay Patel via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class="">
><br class="">
> Author: spatel<br class="">
> Date: Mon Nov 21 16:04:14 2016<br class="">
> New Revision: 287585<br class="">
><br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=287585&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-<wbr class="">project?rev=287585&view=rev</a><br class="">
> Log:<br class="">
> [InstCombine] canonicalize min/max constant to select's false value<br class="">
><br class="">
> This is a first step towards canonicalization and improved folding/codegen<br class="">
> for integer min/max as discussed here:<br class="">
> <a href="http://lists.llvm.org/pipermail/llvm-dev/2016-November/106868.html" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/<wbr class="">pipermail/llvm-dev/2016-<wbr class="">November/106868.html</a><br class="">
><br class="">
> Here, we're just matching the simplest min/max patterns and adjusting the<br class="">
> icmp predicate while swapping the select operands.<br class="">
><br class="">
> I've included FIXME tests in test/Transforms/InstCombine/<wbr class="">select_meta.ll<br class="">
> so it's easier to see how this might be extended (corresponds to the TODO<br class="">
> comment in the code). That's also why I'm using matchSelectPattern()<br class="">
> rather than a simpler check; once the backend is patched, we can just<br class="">
> remove some of the restrictions to allow the obfuscated min/max patterns<br class="">
> in the FIXME tests to be matched.<br class="">
><br class="">
> Differential Revision: <a href="https://reviews.llvm.org/D26525" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/<wbr class="">D26525</a><br class="">
><br class="">
> Modified:<br class="">
>    llvm/trunk/lib/Transforms/<wbr class="">InstCombine/InstCombineSelect.<wbr class="">cpp<br class="">
>    llvm/trunk/test/Transforms/<wbr class="">InstCombine/adjust-for-minmax.<wbr class="">ll<br class="">
>    llvm/trunk/test/Transforms/<wbr class="">InstCombine/div-shift.ll<br class="">
>    llvm/trunk/test/Transforms/<wbr class="">InstCombine/minmax-fold.ll<br class="">
>    llvm/trunk/test/Transforms/<wbr class="">InstCombine/pr27236.ll<br class="">
>    llvm/trunk/test/Transforms/<wbr class="">InstCombine/select_meta.ll<br class="">
>    llvm/trunk/test/Transforms/<wbr class="">InstCombine/sext.ll<br class="">
><br class="">
> Modified: llvm/trunk/lib/Transforms/<wbr class="">InstCombine/InstCombineSelect.<wbr class="">cpp<br class="">
> 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" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/llvm/trunk/lib/<wbr class="">Transforms/InstCombine/<wbr class="">InstCombineSelect.cpp?rev=<wbr class="">287585&r1=287584&r2=287585&<wbr class="">view=diff</a><br class="">
> ==============================<wbr class="">==============================<wbr class="">==================<br class="">
> --- llvm/trunk/lib/Transforms/<wbr class="">InstCombine/InstCombineSelect.<wbr class="">cpp (original)<br class="">
> +++ llvm/trunk/lib/Transforms/<wbr class="">InstCombine/InstCombineSelect.<wbr class="">cpp Mon Nov 21 16:04:14 2016<br class="">
> @@ -500,9 +500,51 @@ static bool adjustMinMax(SelectInst &Sel<br class="">
>   return true;<br class="">
> }<br class="">
><br class="">
> +/// If this is an integer min/max where the select's 'true' operand is a<br class="">
> +/// constant, canonicalize that constant to the 'false' operand:<br class="">
> +/// select (icmp Pred X, C), C, X --> select (icmp Pred' X, C), X, C<br class="">
> +static Instruction *<br class="">
> +<wbr class="">canonicalizeMinMaxWithConstant<wbr class="">(SelectInst &Sel, ICmpInst &Cmp,<br class="">
> +                               InstCombiner::BuilderTy &Builder) {<br class="">
> +  // TODO: We should also canonicalize min/max when the select has a different<br class="">
> +  // constant value than the cmp constant, but we need to fix the backend first.<br class="">
> +  if (!Cmp.hasOneUse() || !isa<Constant>(Cmp.getOperand(<wbr class="">1)) ||<br class="">
> +      !isa<Constant>(Sel.<wbr class="">getTrueValue()) ||<br class="">
> +      isa<Constant>(Sel.<wbr class="">getFalseValue()) ||<br class="">
> +      Cmp.getOperand(1) != Sel.getTrueValue())<br class="">
> +    return nullptr;<br class="">
> +<br class="">
> +  // Canonicalize the compare predicate based on whether we have min or max.<br class="">
> +  Value *LHS, *RHS;<br class="">
> +  ICmpInst::Predicate NewPred;<br class="">
> +  SelectPatternResult SPR = matchSelectPattern(&Sel, LHS, RHS);<br class="">
> +  switch (SPR.Flavor) {<br class="">
> +  case SPF_SMIN: NewPred = ICmpInst::ICMP_SLT; break;<br class="">
> +  case SPF_UMIN: NewPred = ICmpInst::ICMP_ULT; break;<br class="">
> +  case SPF_SMAX: NewPred = ICmpInst::ICMP_SGT; break;<br class="">
> +  case SPF_UMAX: NewPred = ICmpInst::ICMP_UGT; break;<br class="">
> +  default: return nullptr;<br class="">
> +  }<br class="">
> +<br class="">
> +  // Canonicalize the constant to the right side.<br class="">
> +  if (isa<Constant>(LHS))<br class="">
> +    std::swap(LHS, RHS);<br class="">
> +<br class="">
> +  Value *NewCmp = Builder.CreateICmp(NewPred, LHS, RHS);<br class="">
> +  SelectInst *NewSel = SelectInst::Create(NewCmp, LHS, RHS);<br class="">
> +  NewSel->copyMetadata(Sel);<br class="">
> +<br class="">
> +  // We swapped the select operands, so swap the metadata too.<br class="">
> +  NewSel->swapProfMetadata();<br class="">
> +  return NewSel;<br class="">
> +}<br class="">
> +<br class="">
> /// Visit a SelectInst that has an ICmpInst as its first operand.<br class="">
> Instruction *InstCombiner::<wbr class="">foldSelectInstWithICmp(<wbr class="">SelectInst &SI,<br class="">
>                                                   ICmpInst *ICI) {<br class="">
> +  if (Instruction *NewSel = canonicalizeMinMaxWithConstant<wbr class="">(SI, *ICI, *Builder))<br class="">
> +    return NewSel;<br class="">
> +<br class="">
>   bool Changed = adjustMinMax(SI, *ICI);<br class="">
><br class="">
>   ICmpInst::Predicate Pred = ICI->getPredicate();<br class="">
><br class="">
> Modified: llvm/trunk/test/Transforms/<wbr class="">InstCombine/adjust-for-minmax.<wbr class="">ll<br class="">
> 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" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/llvm/trunk/test/<wbr class="">Transforms/InstCombine/adjust-<wbr class="">for-minmax.ll?rev=287585&r1=<wbr class="">287584&r2=287585&view=diff</a><br class="">
> ==============================<wbr class="">==============================<wbr class="">==================<br class="">
> --- llvm/trunk/test/Transforms/<wbr class="">InstCombine/adjust-for-minmax.<wbr class="">ll (original)<br class="">
> +++ llvm/trunk/test/Transforms/<wbr class="">InstCombine/adjust-for-minmax.<wbr class="">ll Mon Nov 21 16:04:14 2016<br class="">
> @@ -29,7 +29,7 @@ define i32 @smin1(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize icmp predicate.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @smax2(i32 %n) {<br class="">
> ; CHECK-LABEL: @smax2(<br class="">
> @@ -42,7 +42,7 @@ define i32 @smax2(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize icmp predicate.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @smin2(i32 %n) {<br class="">
> ; CHECK-LABEL: @smin2(<br class="">
> @@ -55,12 +55,12 @@ define i32 @smin2(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Swap signed pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @smax3(i32 %n) {<br class="">
> ; CHECK-LABEL: @smax3(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp slt i32 %n, 0<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 0, i32 %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp sgt i32 %n, 0<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 0<br class="">
> ; CHECK-NEXT:    ret i32 [[M]]<br class="">
> ;<br class="">
>   %t = icmp sgt i32 %n, -1<br class="">
> @@ -68,12 +68,12 @@ define i32 @smax3(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Swap vector signed pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define <2 x i32> @smax3_vec(<2 x i32> %n) {<br class="">
> ; CHECK-LABEL: @smax3_vec(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> %n, zeroinitializer<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> zeroinitializer, <2 x i32> %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> %n, zeroinitializer<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> zeroinitializer<br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br class="">
> ;<br class="">
>   %t = icmp sgt <2 x i32> %n, <i32 -1, i32 -1><br class="">
> @@ -81,12 +81,12 @@ define <2 x i32> @smax3_vec(<2 x i32> %n<br class="">
>   ret <2 x i32> %m<br class="">
> }<br class="">
><br class="">
> -; Swap signed pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @smin3(i32 %n) {<br class="">
> ; CHECK-LABEL: @smin3(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp sgt i32 %n, 0<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 0, i32 %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp slt i32 %n, 0<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 0<br class="">
> ; CHECK-NEXT:    ret i32 [[M]]<br class="">
> ;<br class="">
>   %t = icmp slt i32 %n, 1<br class="">
> @@ -94,12 +94,12 @@ define i32 @smin3(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Swap vector signed pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define <2 x i32> @smin3_vec(<2 x i32> %n) {<br class="">
> ; CHECK-LABEL: @smin3_vec(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> %n, zeroinitializer<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> zeroinitializer, <2 x i32> %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> %n, zeroinitializer<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> zeroinitializer<br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br class="">
> ;<br class="">
>   %t = icmp slt <2 x i32> %n, <i32 1, i32 1><br class="">
> @@ -107,12 +107,12 @@ define <2 x i32> @smin3_vec(<2 x i32> %n<br class="">
>   ret <2 x i32> %m<br class="">
> }<br class="">
><br class="">
> -; Swap unsigned pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @umax3(i32 %n) {<br class="">
> ; CHECK-LABEL: @umax3(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 %n, 5<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 5, i32 %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp ugt i32 %n, 5<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 5<br class="">
> ; CHECK-NEXT:    ret i32 [[M]]<br class="">
> ;<br class="">
>   %t = icmp ugt i32 %n, 4<br class="">
> @@ -120,12 +120,12 @@ define i32 @umax3(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Swap vector unsigned pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define <2 x i32> @umax3_vec(<2 x i32> %n) {<br class="">
> ; CHECK-LABEL: @umax3_vec(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> %n, <i32 5, i32 5><br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> <i32 5, i32 5>, <2 x i32> %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> %n, <i32 5, i32 5><br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> <i32 5, i32 5><br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br class="">
> ;<br class="">
>   %t = icmp ugt <2 x i32> %n, <i32 4, i32 4><br class="">
> @@ -133,12 +133,12 @@ define <2 x i32> @umax3_vec(<2 x i32> %n<br class="">
>   ret <2 x i32> %m<br class="">
> }<br class="">
><br class="">
> -; Swap unsigned pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @umin3(i32 %n) {<br class="">
> ; CHECK-LABEL: @umin3(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp ugt i32 %n, 6<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 6, i32 %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 %n, 6<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 6<br class="">
> ; CHECK-NEXT:    ret i32 [[M]]<br class="">
> ;<br class="">
>   %t = icmp ult i32 %n, 7<br class="">
> @@ -146,12 +146,12 @@ define i32 @umin3(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Swap vector unsigned pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define <2 x i32> @umin3_vec(<2 x i32> %n) {<br class="">
> ; CHECK-LABEL: @umin3_vec(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> %n, <i32 6, i32 6><br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> <i32 6, i32 6>, <2 x i32> %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> %n, <i32 6, i32 6><br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> <i32 6, i32 6><br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br class="">
> ;<br class="">
>   %t = icmp ult <2 x i32> %n, <i32 7, i32 7><br class="">
> @@ -159,12 +159,12 @@ define <2 x i32> @umin3_vec(<2 x i32> %n<br class="">
>   ret <2 x i32> %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize signed pred and swap pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @smax4(i32 %n) {<br class="">
> ; CHECK-LABEL: @smax4(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp slt i32 %n, 0<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 0, i32 %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp sgt i32 %n, 0<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 0<br class="">
> ; CHECK-NEXT:    ret i32 [[M]]<br class="">
> ;<br class="">
>   %t = icmp sge i32 %n, 0<br class="">
> @@ -172,12 +172,12 @@ define i32 @smax4(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize vector signed pred and swap pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define <2 x i32> @smax4_vec(<2 x i32> %n) {<br class="">
> ; CHECK-LABEL: @smax4_vec(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> %n, zeroinitializer<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> zeroinitializer, <2 x i32> %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> %n, zeroinitializer<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> zeroinitializer<br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br class="">
> ;<br class="">
>   %t = icmp sge <2 x i32> %n, zeroinitializer<br class="">
> @@ -185,12 +185,12 @@ define <2 x i32> @smax4_vec(<2 x i32> %n<br class="">
>   ret <2 x i32> %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize signed pred and swap pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @smin4(i32 %n) {<br class="">
> ; CHECK-LABEL: @smin4(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp sgt i32 %n, 0<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 0, i32 %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp slt i32 %n, 0<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 0<br class="">
> ; CHECK-NEXT:    ret i32 [[M]]<br class="">
> ;<br class="">
>   %t = icmp sle i32 %n, 0<br class="">
> @@ -198,12 +198,12 @@ define i32 @smin4(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize vector signed pred and swap pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define <2 x i32> @smin4_vec(<2 x i32> %n) {<br class="">
> ; CHECK-LABEL: @smin4_vec(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp sgt <2 x i32> %n, zeroinitializer<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> zeroinitializer, <2 x i32> %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp slt <2 x i32> %n, zeroinitializer<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> zeroinitializer<br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br class="">
> ;<br class="">
>   %t = icmp sle <2 x i32> %n, zeroinitializer<br class="">
> @@ -211,12 +211,12 @@ define <2 x i32> @smin4_vec(<2 x i32> %n<br class="">
>   ret <2 x i32> %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize unsigned pred and swap pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @umax4(i32 %n) {<br class="">
> ; CHECK-LABEL: @umax4(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 %n, 8<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 8, i32 %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp ugt i32 %n, 8<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 8<br class="">
> ; CHECK-NEXT:    ret i32 [[M]]<br class="">
> ;<br class="">
>   %t = icmp uge i32 %n, 8<br class="">
> @@ -224,12 +224,12 @@ define i32 @umax4(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize vector unsigned pred and swap pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define <2 x i32> @umax4_vec(<2 x i32> %n) {<br class="">
> ; CHECK-LABEL: @umax4_vec(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> %n, <i32 8, i32 8><br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> <i32 8, i32 8>, <2 x i32> %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> %n, <i32 8, i32 8><br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> <i32 8, i32 8><br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br class="">
> ;<br class="">
>   %t = icmp uge <2 x i32> %n, <i32 8, i32 8><br class="">
> @@ -237,12 +237,12 @@ define <2 x i32> @umax4_vec(<2 x i32> %n<br class="">
>   ret <2 x i32> %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize unsigned pred and swap pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define i32 @umin4(i32 %n) {<br class="">
> ; CHECK-LABEL: @umin4(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp ugt i32 %n, 9<br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 9, i32 %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp ult i32 %n, 9<br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select i1 [[T]], i32 %n, i32 9<br class="">
> ; CHECK-NEXT:    ret i32 [[M]]<br class="">
> ;<br class="">
>   %t = icmp ule i32 %n, 9<br class="">
> @@ -250,12 +250,12 @@ define i32 @umin4(i32 %n) {<br class="">
>   ret i32 %m<br class="">
> }<br class="">
><br class="">
> -; Canonicalize vector unsigned pred and swap pred and select ops.<br class="">
> +; Canonicalize min/max.<br class="">
><br class="">
> define <2 x i32> @umin4_vec(<2 x i32> %n) {<br class="">
> ; CHECK-LABEL: @umin4_vec(<br class="">
> -; CHECK-NEXT:    [[T:%.*]] = icmp ugt <2 x i32> %n, <i32 9, i32 9><br class="">
> -; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> <i32 9, i32 9>, <2 x i32> %n<br class="">
> +; CHECK-NEXT:    [[T:%.*]] = icmp ult <2 x i32> %n, <i32 9, i32 9><br class="">
> +; CHECK-NEXT:    [[M:%.*]] = select <2 x i1> [[T]], <2 x i32> %n, <2 x i32> <i32 9, i32 9><br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[M]]<br class="">
> ;<br class="">
>   %t = icmp ule <2 x i32> %n, <i32 9, i32 9><br class="">
> @@ -266,8 +266,8 @@ define <2 x i32> @umin4_vec(<2 x i32> %n<br class="">
> define i64 @smax_sext(i32 %a) {<br class="">
> ; CHECK-LABEL: @smax_sext(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i64 [[A_EXT]], 0<br class="">
> -; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 0, i64 [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i64 [[A_EXT]], 0<br class="">
> +; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 0<br class="">
> ; CHECK-NEXT:    ret i64 [[MAX]]<br class="">
> ;<br class="">
>   %a_ext = sext i32 %a to i64<br class="">
> @@ -279,8 +279,8 @@ define i64 @smax_sext(i32 %a) {<br class="">
> define <2 x i64> @smax_sext_vec(<2 x i32> %a) {<br class="">
> ; CHECK-LABEL: @smax_sext_vec(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext <2 x i32> %a to <2 x i64><br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt <2 x i64> [[A_EXT]], zeroinitializer<br class="">
> -; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> zeroinitializer, <2 x i64> [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i64> [[A_EXT]], zeroinitializer<br class="">
> +; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> zeroinitializer<br class="">
> ; CHECK-NEXT:    ret <2 x i64> [[MAX]]<br class="">
> ;<br class="">
>   %a_ext = sext <2 x i32> %a to <2 x i64><br class="">
> @@ -292,8 +292,8 @@ define <2 x i64> @smax_sext_vec(<2 x i32<br class="">
> define i64 @smin_sext(i32 %a) {<br class="">
> ; CHECK-LABEL: @smin_sext(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i64 [[A_EXT]], 0<br class="">
> -; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 0, i64 [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i64 [[A_EXT]], 0<br class="">
> +; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 0<br class="">
> ; CHECK-NEXT:    ret i64 [[MIN]]<br class="">
> ;<br class="">
>   %a_ext = sext i32 %a to i64<br class="">
> @@ -305,8 +305,8 @@ define i64 @smin_sext(i32 %a) {<br class="">
> define <2 x i64>@smin_sext_vec(<2 x i32> %a) {<br class="">
> ; CHECK-LABEL: @smin_sext_vec(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext <2 x i32> %a to <2 x i64><br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i64> [[A_EXT]], zeroinitializer<br class="">
> -; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> zeroinitializer, <2 x i64> [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt <2 x i64> [[A_EXT]], zeroinitializer<br class="">
> +; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> zeroinitializer<br class="">
> ; CHECK-NEXT:    ret <2 x i64> [[MIN]]<br class="">
> ;<br class="">
>   %a_ext = sext <2 x i32> %a to <2 x i64><br class="">
> @@ -318,8 +318,8 @@ define <2 x i64>@smin_sext_vec(<2 x i32><br class="">
> define i64 @umax_sext(i32 %a) {<br class="">
> ; CHECK-LABEL: @umax_sext(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[A_EXT]], 3<br class="">
> -; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 3, i64 [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i64 [[A_EXT]], 3<br class="">
> +; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 3<br class="">
> ; CHECK-NEXT:    ret i64 [[MAX]]<br class="">
> ;<br class="">
>   %a_ext = sext i32 %a to i64<br class="">
> @@ -331,8 +331,8 @@ define i64 @umax_sext(i32 %a) {<br class="">
> define <2 x i64> @umax_sext_vec(<2 x i32> %a) {<br class="">
> ; CHECK-LABEL: @umax_sext_vec(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext <2 x i32> %a to <2 x i64><br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i64> [[A_EXT]], <i64 3, i64 3><br class="">
> -; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> <i64 3, i64 3>, <2 x i64> [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i64> [[A_EXT]], <i64 3, i64 3><br class="">
> +; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> <i64 3, i64 3><br class="">
> ; CHECK-NEXT:    ret <2 x i64> [[MAX]]<br class="">
> ;<br class="">
>   %a_ext = sext <2 x i32> %a to <2 x i64><br class="">
> @@ -344,8 +344,8 @@ define <2 x i64> @umax_sext_vec(<2 x i32<br class="">
> define i64 @umin_sext(i32 %a) {<br class="">
> ; CHECK-LABEL: @umin_sext(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i64 [[A_EXT]], 2<br class="">
> -; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 2, i64 [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[A_EXT]], 2<br class="">
> +; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 2<br class="">
> ; CHECK-NEXT:    ret i64 [[MIN]]<br class="">
> ;<br class="">
>   %a_ext = sext i32 %a to i64<br class="">
> @@ -357,8 +357,8 @@ define i64 @umin_sext(i32 %a) {<br class="">
> define <2 x i64> @umin_sext_vec(<2 x i32> %a) {<br class="">
> ; CHECK-LABEL: @umin_sext_vec(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext <2 x i32> %a to <2 x i64><br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i64> [[A_EXT]], <i64 2, i64 2><br class="">
> -; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> <i64 2, i64 2>, <2 x i64> [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i64> [[A_EXT]], <i64 2, i64 2><br class="">
> +; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> <i64 2, i64 2><br class="">
> ; CHECK-NEXT:    ret <2 x i64> [[MIN]]<br class="">
> ;<br class="">
>   %a_ext = sext <2 x i32> %a to <2 x i64><br class="">
> @@ -422,8 +422,8 @@ define <2 x i64> @umin_sext2_vec(<2 x i3<br class="">
> define i64 @umax_zext(i32 %a) {<br class="">
> ; CHECK-LABEL: @umax_zext(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = zext i32 %a to i64<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[A_EXT]], 3<br class="">
> -; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 3, i64 [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i64 [[A_EXT]], 3<br class="">
> +; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 3<br class="">
> ; CHECK-NEXT:    ret i64 [[MAX]]<br class="">
> ;<br class="">
>   %a_ext = zext i32 %a to i64<br class="">
> @@ -435,8 +435,8 @@ define i64 @umax_zext(i32 %a) {<br class="">
> define <2 x i64> @umax_zext_vec(<2 x i32> %a) {<br class="">
> ; CHECK-LABEL: @umax_zext_vec(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = zext <2 x i32> %a to <2 x i64><br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i64> [[A_EXT]], <i64 3, i64 3><br class="">
> -; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> <i64 3, i64 3>, <2 x i64> [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i64> [[A_EXT]], <i64 3, i64 3><br class="">
> +; CHECK-NEXT:    [[MAX:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> <i64 3, i64 3><br class="">
> ; CHECK-NEXT:    ret <2 x i64> [[MAX]]<br class="">
> ;<br class="">
>   %a_ext = zext <2 x i32> %a to <2 x i64><br class="">
> @@ -448,8 +448,8 @@ define <2 x i64> @umax_zext_vec(<2 x i32<br class="">
> define i64 @umin_zext(i32 %a) {<br class="">
> ; CHECK-LABEL: @umin_zext(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = zext i32 %a to i64<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i64 [[A_EXT]], 2<br class="">
> -; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 2, i64 [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[A_EXT]], 2<br class="">
> +; CHECK-NEXT:    [[MIN:%.*]] = select i1 [[CMP]], i64 [[A_EXT]], i64 2<br class="">
> ; CHECK-NEXT:    ret i64 [[MIN]]<br class="">
> ;<br class="">
>   %a_ext = zext i32 %a to i64<br class="">
> @@ -461,8 +461,8 @@ define i64 @umin_zext(i32 %a) {<br class="">
> define <2 x i64> @umin_zext_vec(<2 x i32> %a) {<br class="">
> ; CHECK-LABEL: @umin_zext_vec(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = zext <2 x i32> %a to <2 x i64><br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt <2 x i64> [[A_EXT]], <i64 2, i64 2><br class="">
> -; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> <i64 2, i64 2>, <2 x i64> [[A_EXT]]<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp ult <2 x i64> [[A_EXT]], <i64 2, i64 2><br class="">
> +; CHECK-NEXT:    [[MIN:%.*]] = select <2 x i1> [[CMP]], <2 x i64> [[A_EXT]], <2 x i64> <i64 2, i64 2><br class="">
> ; CHECK-NEXT:    ret <2 x i64> [[MIN]]<br class="">
> ;<br class="">
>   %a_ext = zext <2 x i32> %a to <2 x i64><br class="">
><br class="">
> Modified: llvm/trunk/test/Transforms/<wbr class="">InstCombine/div-shift.ll<br class="">
> 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" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/llvm/trunk/test/<wbr class="">Transforms/InstCombine/div-<wbr class="">shift.ll?rev=287585&r1=287584&<wbr class="">r2=287585&view=diff</a><br class="">
> ==============================<wbr class="">==============================<wbr class="">==================<br class="">
> --- llvm/trunk/test/Transforms/<wbr class="">InstCombine/div-shift.ll (original)<br class="">
> +++ llvm/trunk/test/Transforms/<wbr class="">InstCombine/div-shift.ll Mon Nov 21 16:04:14 2016<br class="">
> @@ -45,8 +45,8 @@ define i64 @t3(i64 %x, i32 %y) {<br class="">
><br class="">
> define i32 @t4(i32 %x, i32 %y) {<br class="">
> ; CHECK-LABEL: @t4(<br class="">
> -; CHECK-NEXT:    [[TMP1:%.*]] = icmp ult i32 %y, 5<br class="">
> -; CHECK-NEXT:    [[DOTV:%.*]] = select i1 [[TMP1]], i32 5, i32 %y<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt i32 %y, 5<br class="">
> +; CHECK-NEXT:    [[DOTV:%.*]] = select i1 [[TMP1]], i32 %y, i32 5<br class="">
> ; CHECK-NEXT:    [[TMP2:%.*]] = lshr i32 %x, [[DOTV]]<br class="">
> ; CHECK-NEXT:    ret i32 [[TMP2]]<br class="">
> ;<br class="">
><br class="">
> Modified: llvm/trunk/test/Transforms/<wbr class="">InstCombine/minmax-fold.ll<br class="">
> 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" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/llvm/trunk/test/<wbr class="">Transforms/InstCombine/minmax-<wbr class="">fold.ll?rev=287585&r1=287584&<wbr class="">r2=287585&view=diff</a><br class="">
> ==============================<wbr class="">==============================<wbr class="">==================<br class="">
> --- llvm/trunk/test/Transforms/<wbr class="">InstCombine/minmax-fold.ll (original)<br class="">
> +++ llvm/trunk/test/Transforms/<wbr class="">InstCombine/minmax-fold.ll Mon Nov 21 16:04:14 2016<br class="">
> @@ -200,8 +200,8 @@ define <4 x float> @bitcasts_icmp(<2 x i<br class="">
> ; SMIN(SMIN(X, 11), 92) -> SMIN(X, 11)<br class="">
> define i32 @test68(i32 %x) {<br class="">
> ; CHECK-LABEL: @test68(<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, 11<br class="">
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 11, i32 %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 %x, 11<br class="">
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 11<br class="">
> ; CHECK-NEXT:    ret i32 [[COND]]<br class="">
> ;<br class="">
>   %cmp = icmp slt i32 11, %x<br class="">
> @@ -213,8 +213,8 @@ define i32 @test68(i32 %x) {<br class="">
><br class="">
> define <2 x i32> @test68vec(<2 x i32> %x) {<br class="">
> ; CHECK-LABEL: @test68vec(<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 11, i32 11><br class="">
> -; CHECK-NEXT:    [[COND:%.*]] = select <2 x i1> [[CMP]], <2 x i32> <i32 11, i32 11>, <2 x i32> %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt <2 x i32> %x, <i32 11, i32 11><br class="">
> +; CHECK-NEXT:    [[COND:%.*]] = select <2 x i1> [[TMP1]], <2 x i32> %x, <2 x i32> <i32 11, i32 11><br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[COND]]<br class="">
> ;<br class="">
>   %cmp = icmp slt <2 x i32> <i32 11, i32 11>, %x<br class="">
> @@ -227,8 +227,8 @@ define <2 x i32> @test68vec(<2 x i32> %x<br class="">
> ; MIN(MIN(X, 24), 83) -> MIN(X, 24)<br class="">
> define i32 @test69(i32 %x) {<br class="">
> ; CHECK-LABEL: @test69(<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ugt i32 %x, 24<br class="">
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 24, i32 %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ult i32 %x, 24<br class="">
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 24<br class="">
> ; CHECK-NEXT:    ret i32 [[COND]]<br class="">
> ;<br class="">
>   %cmp = icmp ult i32 24, %x<br class="">
> @@ -241,8 +241,8 @@ define i32 @test69(i32 %x) {<br class="">
> ; SMAX(SMAX(X, 75), 36) -> SMAX(X, 75)<br class="">
> define i32 @test70(i32 %x) {<br class="">
> ; CHECK-LABEL: @test70(<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 75<br class="">
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 75, i32 %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %x, 75<br class="">
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 75<br class="">
> ; CHECK-NEXT:    ret i32 [[COND]]<br class="">
> ;<br class="">
>   %cmp = icmp slt i32 %x, 75<br class="">
> @@ -255,8 +255,8 @@ define i32 @test70(i32 %x) {<br class="">
> ; MAX(MAX(X, 68), 47) -> MAX(X, 68)<br class="">
> define i32 @test71(i32 %x) {<br class="">
> ; CHECK-LABEL: @test71(<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 %x, 68<br class="">
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 68, i32 %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt i32 %x, 68<br class="">
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 68<br class="">
> ; CHECK-NEXT:    ret i32 [[COND]]<br class="">
> ;<br class="">
>   %cmp = icmp ult i32 %x, 68<br class="">
> @@ -269,8 +269,8 @@ define i32 @test71(i32 %x) {<br class="">
> ; SMIN(SMIN(X, 92), 11) -> SMIN(X, 11)<br class="">
> define i32 @test72(i32 %x) {<br class="">
> ; CHECK-LABEL: @test72(<br class="">
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt i32 %x, 11<br class="">
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 11, i32 %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 %x, 11<br class="">
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 11<br class="">
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br class="">
> ;<br class="">
>   %cmp = icmp sgt i32 %x, 92<br class="">
> @@ -280,14 +280,14 @@ define i32 @test72(i32 %x) {<br class="">
>   ret i32 %retval<br class="">
> }<br class="">
><br class="">
> -; FIXME - vector neglect: FoldOrOfICmps()<br class="">
> +; FIXME - vector neglect: FoldAndOfICmps() / FoldOrOfICmps()<br class="">
><br class="">
> define <2 x i32> @test72vec(<2 x i32> %x) {<br class="">
> ; CHECK-LABEL: @test72vec(<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 92, i32 92><br class="">
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt <2 x i32> %x, <i32 11, i32 11><br class="">
> -; CHECK-NEXT:    [[CMP3:%.*]] = or <2 x i1> [[CMP]], [[CMP31:%.*]]<br class="">
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select <2 x i1> [[CMP3]], <2 x i32> <i32 11, i32 11>, <2 x i32> %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt <2 x i32> %x, <i32 92, i32 92><br class="">
> +; CHECK-NEXT:    [[TMP2:%.*]] = icmp slt <2 x i32> %x, <i32 11, i32 11><br class="">
> +; CHECK-NEXT:    [[TMP3:%.*]] = and <2 x i1> [[TMP1]], [[TMP2]]<br class="">
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select <2 x i1> [[TMP3]], <2 x i32> %x, <2 x i32> <i32 11, i32 11><br class="">
> ; CHECK-NEXT:    ret <2 x i32> [[RETVAL]]<br class="">
> ;<br class="">
>   %cmp = icmp sgt <2 x i32> %x, <i32 92, i32 92><br class="">
> @@ -300,8 +300,8 @@ define <2 x i32> @test72vec(<2 x i32> %x<br class="">
> ; MIN(MIN(X, 83), 24) -> MIN(X, 24)<br class="">
> define i32 @test73(i32 %x) {<br class="">
> ; CHECK-LABEL: @test73(<br class="">
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp ugt i32 %x, 24<br class="">
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 24, i32 %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ult i32 %x, 24<br class="">
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 24<br class="">
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br class="">
> ;<br class="">
>   %cmp = icmp ugt i32 %x, 83<br class="">
> @@ -314,8 +314,8 @@ define i32 @test73(i32 %x) {<br class="">
> ; SMAX(SMAX(X, 36), 75) -> SMAX(X, 75)<br class="">
> define i32 @test74(i32 %x) {<br class="">
> ; CHECK-LABEL: @test74(<br class="">
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp slt i32 %x, 75<br class="">
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 75, i32 %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %x, 75<br class="">
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 75<br class="">
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br class="">
> ;<br class="">
>   %cmp = icmp slt i32 %x, 36<br class="">
> @@ -328,8 +328,8 @@ define i32 @test74(i32 %x) {<br class="">
> ; MAX(MAX(X, 47), 68) -> MAX(X, 68)<br class="">
> define i32 @test75(i32 %x) {<br class="">
> ; CHECK-LABEL: @test75(<br class="">
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp ult i32 %x, 68<br class="">
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 68, i32 %x<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp ugt i32 %x, 68<br class="">
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 68<br class="">
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br class="">
> ;<br class="">
>   %cmp = icmp ult i32 %x, 47<br class="">
><br class="">
> Modified: llvm/trunk/test/Transforms/<wbr class="">InstCombine/pr27236.ll<br class="">
> 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" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/llvm/trunk/test/<wbr class="">Transforms/InstCombine/<wbr class="">pr27236.ll?rev=287585&r1=<wbr class="">287584&r2=287585&view=diff</a><br class="">
> ==============================<wbr class="">==============================<wbr class="">==================<br class="">
> --- llvm/trunk/test/Transforms/<wbr class="">InstCombine/pr27236.ll (original)<br class="">
> +++ llvm/trunk/test/Transforms/<wbr class="">InstCombine/pr27236.ll Mon Nov 21 16:04:14 2016<br class="">
> @@ -3,8 +3,8 @@<br class="">
><br class="">
> define float @test1(i32 %scale) {<br class="">
> ; CHECK-LABEL: @test1(<br class="">
> -; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 %scale, 1<br class="">
> -; CHECK-NEXT:    [[TMP2:%.*]] = select i1 [[TMP1]], i32 1, i32 %scale<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %scale, 1<br class="">
> +; CHECK-NEXT:    [[TMP2:%.*]] = select i1 [[TMP1]], i32 %scale, i32 1<br class="">
> ; CHECK-NEXT:    [[TMP3:%.*]] = sitofp i32 [[TMP2]] to float<br class="">
> ; CHECK-NEXT:    [[TMP4:%.*]] = icmp sgt i32 [[TMP2]], 0<br class="">
> ; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[TMP4]], float [[TMP3]], float 0.000000e+00<br class="">
><br class="">
> Modified: llvm/trunk/test/Transforms/<wbr class="">InstCombine/select_meta.ll<br class="">
> 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" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/llvm/trunk/test/<wbr class="">Transforms/InstCombine/select_<wbr class="">meta.ll?rev=287585&r1=287584&<wbr class="">r2=287585&view=diff</a><br class="">
> ==============================<wbr class="">==============================<wbr class="">==================<br class="">
> --- llvm/trunk/test/Transforms/<wbr class="">InstCombine/select_meta.ll (original)<br class="">
> +++ llvm/trunk/test/Transforms/<wbr class="">InstCombine/select_meta.ll Mon Nov 21 16:04:14 2016<br class="">
> @@ -1,4 +1,6 @@<br class="">
> -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py and enhanced to include metadata checking.<br class="">
> +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py<br class="">
> +; and enhanced to include metadata checking.<br class="">
> +<br class="">
> ; RUN: opt < %s -instcombine -S | FileCheck %s<br class="">
><br class="">
> define i32 @foo(i32) local_unnamed_addr #0  {<br class="">
> @@ -51,12 +53,11 @@ define i32 @foo2(i32, i32) local_unnamed<br class="">
>   ret i32 %6<br class="">
> }<br class="">
><br class="">
> -; condition swapped<br class="">
> define i64 @test43(i32 %a) nounwind {<br class="">
> ; CHECK-LABEL: @test43(<br class="">
> ; CHECK-NEXT:    [[A_EXT:%.*]] = sext i32 %a to i64<br class="">
> -; CHECK-NEXT:    [[IS_A_NONNEGATIVE:%.*]] = icmp slt i64 [[A_EXT]], 0<br class="">
> -; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[IS_A_NONNEGATIVE]], i64 0, i64 [[A_EXT]], !prof ![[MD3:[0-9]+]]<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i64 [[A_EXT]], 0<br class="">
> +; CHECK-NEXT:    [[MAX:%.*]] = select i1 [[TMP1]], i64 [[A_EXT]], i64 0, !prof ![[MD1]]<br class="">
> ; CHECK-NEXT:    ret i64 [[MAX]]<br class="">
> ;<br class="">
>   %a_ext = sext i32 %a to i64<br class="">
> @@ -136,10 +137,12 @@ define i32 @test30(i32 %x, i32 %y) {<br class="">
>   ret i32 %retval<br class="">
> }<br class="">
><br class="">
> +; Swap predicate / metadata order<br class="">
> +; SMAX(SMAX(X, 75), 36) -> SMAX(X, 75)<br class="">
> define i32 @test70(i32 %x) {<br class="">
> ; CHECK-LABEL: @test70(<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 75<br class="">
> -; CHECK-NEXT:    [[COND:%.*]] = select i1 [[CMP]], i32 75, i32 %x, !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %x, 75<br class="">
> +; CHECK-NEXT:    [[COND:%.*]] = select i1 [[TMP1]], i32 %x, i32 75, !prof ![[MD3:[0-9]+]]<br class="">
> ; CHECK-NEXT:    ret i32 [[COND]]<br class="">
> ;<br class="">
>   %cmp = icmp slt i32 %x, 75<br class="">
> @@ -149,12 +152,12 @@ define i32 @test70(i32 %x) {<br class="">
>   ret i32 %retval<br class="">
> }<br class="">
><br class="">
> -<br class="">
> +; Swap predicate / metadata order<br class="">
> ; SMIN(SMIN(X, 92), 11) -> SMIN(X, 11)<br class="">
> define i32 @test72(i32 %x) {<br class="">
> ; CHECK-LABEL: @test72(<br class="">
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp sgt i32 %x, 11<br class="">
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 11, i32 %x, !prof ![[MD2:[0-9]+]]<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp slt i32 %x, 11<br class="">
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 11, !prof ![[MD4:[0-9]+]]<br class="">
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br class="">
> ;<br class="">
>   %cmp = icmp sgt i32 %x, 92<br class="">
> @@ -164,11 +167,12 @@ define i32 @test72(i32 %x) {<br class="">
>   ret i32 %retval<br class="">
> }<br class="">
><br class="">
> +; Swap predicate / metadata order<br class="">
> ; SMAX(SMAX(X, 36), 75) -> SMAX(X, 75)<br class="">
> define i32 @test74(i32 %x) {<br class="">
> ; CHECK-LABEL: @test74(<br class="">
> -; CHECK-NEXT:    [[CMP31:%.*]] = icmp slt i32 %x, 75<br class="">
> -; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[CMP31]], i32 75, i32 %x, !prof ![[MD2]]<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 %x, 75<br class="">
> +; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[TMP1]], i32 %x, i32 75, !prof ![[MD4]]<br class="">
> ; CHECK-NEXT:    ret i32 [[RETVAL]]<br class="">
> ;<br class="">
>   %cmp = icmp slt i32 %x, 36<br class="">
> @@ -178,10 +182,122 @@ define i32 @test74(i32 %x) {<br class="">
>   ret i32 %retval<br class="">
> }<br class="">
><br class="">
> +; FIXME:<br class="">
> +; The compare should change, but the metadata remains the same because the select operands are not swapped.<br class="">
> +define i32 @smin1(i32 %x) {<br class="">
> +; CHECK-LABEL: @smin1(<br class="">
> +; CHECK-NEXT:    [[NOT_X:%.*]] = xor i32 %x, -1<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, 0<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 [[NOT_X]], i32 -1, !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    ret i32 [[SEL]]<br class="">
> +;<br class="">
> +  %not_x = xor i32 %x, -1<br class="">
> +  %cmp = icmp sgt i32 %x, 0<br class="">
> +  %sel = select i1 %cmp, i32 %not_x, i32 -1, !prof !1<br class="">
> +  ret i32 %sel<br class="">
> +}<br class="">
> +<br class="">
> +; FIXME:<br class="">
> +; The compare should change, and the metadata is swapped because the select operands are swapped.<br class="">
> +define i32 @smin2(i32 %x) {<br class="">
> +; CHECK-LABEL: @smin2(<br class="">
> +; CHECK-NEXT:    [[NOT_X:%.*]] = xor i32 %x, -1<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 0<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 -1, i32 [[NOT_X]], !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    ret i32 [[SEL]]<br class="">
> +;<br class="">
> +  %not_x = xor i32 %x, -1<br class="">
> +  %cmp = icmp slt i32 %x, 0<br class="">
> +  %sel = select i1 %cmp, i32 -1, i32 %not_x, !prof !1<br class="">
> +  ret i32 %sel<br class="">
> +}<br class="">
> +<br class="">
> +; FIXME:<br class="">
> +; The compare should change, but the metadata remains the same because the select operands are not swapped.<br class="">
> +define i32 @smax1(i32 %x) {<br class="">
> +; CHECK-LABEL: @smax1(<br class="">
> +; CHECK-NEXT:    [[NOT_X:%.*]] = xor i32 %x, -1<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 0<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 [[NOT_X]], i32 -1, !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    ret i32 [[SEL]]<br class="">
> +;<br class="">
> +  %not_x = xor i32 %x, -1<br class="">
> +  %cmp = icmp slt i32 %x, 0<br class="">
> +  %sel = select i1 %cmp, i32 %not_x, i32 -1, !prof !1<br class="">
> +  ret i32 %sel<br class="">
> +}<br class="">
> +<br class="">
> +; FIXME:<br class="">
> +; The compare should change, and the metadata is swapped because the select operands are swapped.<br class="">
> +define i32 @smax2(i32 %x) {<br class="">
> +; CHECK-LABEL: @smax2(<br class="">
> +; CHECK-NEXT:    [[NOT_X:%.*]] = xor i32 %x, -1<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, 0<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 -1, i32 [[NOT_X]], !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    ret i32 [[SEL]]<br class="">
> +;<br class="">
> +  %not_x = xor i32 %x, -1<br class="">
> +  %cmp = icmp sgt i32 %x, 0<br class="">
> +  %sel = select i1 %cmp, i32 -1, i32 %not_x, !prof !1<br class="">
> +  ret i32 %sel<br class="">
> +}<br class="">
> +<br class="">
> +; FIXME:<br class="">
> +; The compare should change, but the metadata remains the same because the select operands are not swapped.<br class="">
> +define i32 @umin1(i32 %x) {<br class="">
> +; CHECK-LABEL: @umin1(<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, -1<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 %x, i32 -2147483648, !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    ret i32 [[SEL]]<br class="">
> +;<br class="">
> +  %cmp = icmp sgt i32 %x, -1<br class="">
> +  %sel = select i1 %cmp, i32 %x, i32 -2147483648, !prof !1<br class="">
> +  ret i32 %sel<br class="">
> +}<br class="">
> +<br class="">
> +; FIXME:<br class="">
> +; The compare should change, and the metadata is swapped because the select operands are swapped.<br class="">
> +define i32 @umin2(i32 %x) {<br class="">
> +; CHECK-LABEL: @umin2(<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 0<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 2147483647, i32 %x, !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    ret i32 [[SEL]]<br class="">
> +;<br class="">
> +  %cmp = icmp slt i32 %x, 0<br class="">
> +  %sel = select i1 %cmp, i32 2147483647, i32 %x, !prof !1<br class="">
> +  ret i32 %sel<br class="">
> +}<br class="">
> +<br class="">
> +; FIXME:<br class="">
> +; The compare should change, but the metadata remains the same because the select operands are not swapped.<br class="">
> +define i32 @umax1(i32 %x) {<br class="">
> +; CHECK-LABEL: @umax1(<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 %x, 0<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 %x, i32 2147483647, !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    ret i32 [[SEL]]<br class="">
> +;<br class="">
> +  %cmp = icmp slt i32 %x, 0<br class="">
> +  %sel = select i1 %cmp, i32 %x, i32 2147483647, !prof !1<br class="">
> +  ret i32 %sel<br class="">
> +}<br class="">
> +<br class="">
> +; FIXME:<br class="">
> +; The compare should change, and the metadata is swapped because the select operands are swapped.<br class="">
> +define i32 @umax2(i32 %x) {<br class="">
> +; CHECK-LABEL: @umax2(<br class="">
> +; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 %x, -1<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 -2147483648, i32 %x, !prof ![[MD1]]<br class="">
> +; CHECK-NEXT:    ret i32 [[SEL]]<br class="">
> +;<br class="">
> +  %cmp = icmp sgt i32 %x, -1<br class="">
> +  %sel = select i1 %cmp, i32 -2147483648, i32 %x, !prof !1<br class="">
> +  ret i32 %sel<br class="">
> +}<br class="">
> +<br class="">
> !1 = !{!"branch_weights", i32 2, i32 10}<br class="">
> !2 = !{!"branch_weights", i32 3, i32 10}<br class="">
><br class="">
> ; CHECK-DAG: ![[MD1]] = !{!"branch_weights", i32 2, i32 10}<br class="">
> -; CHECK-DAG: ![[MD2]] = !{!"branch_weights", i32 3, i32 10}<br class="">
> ; CHECK-DAG: ![[MD3]] = !{!"branch_weights", i32 10, i32 2}<br class="">
> +; CHECK-DAG: ![[MD4]] = !{!"branch_weights", i32 10, i32 3}<br class="">
><br class="">
><br class="">
> Modified: llvm/trunk/test/Transforms/<wbr class="">InstCombine/sext.ll<br class="">
> 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" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/llvm/trunk/test/<wbr class="">Transforms/InstCombine/sext.<wbr class="">ll?rev=287585&r1=287584&r2=<wbr class="">287585&view=diff</a><br class="">
> ==============================<wbr class="">==============================<wbr class="">==================<br class="">
> --- llvm/trunk/test/Transforms/<wbr class="">InstCombine/sext.ll (original)<br class="">
> +++ llvm/trunk/test/Transforms/<wbr class="">InstCombine/sext.ll Mon Nov 21 16:04:14 2016<br class="">
> @@ -229,10 +229,10 @@ define i32 @test17(i1 %x) {<br class="">
><br class="">
> define i32 @test18(i16 %x) {<br class="">
> ; CHECK-LABEL: @test18(<br class="">
> -; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i16 %x, 0<br class="">
> -; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i16 0, i16 %x<br class="">
> -; CHECK-NEXT:    [[TMP1:%.*]] = zext i16 [[SEL]] to i32<br class="">
> -; CHECK-NEXT:    ret i32 [[TMP1]]<br class="">
> +; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i16 %x, 0<br class="">
> +; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[TMP1]], i16 %x, i16 0<br class="">
> +; CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[SEL]] to i32<br class="">
> +; CHECK-NEXT:    ret i32 [[TMP2]]<br class="">
> ;<br class="">
>   %cmp = icmp slt i16 %x, 0<br class="">
>   %sel = select i1 %cmp, i16 0, i16 %x<br class="">
><br class="">
><br class="">
> ______________________________<wbr class="">_________________<br class="">
> llvm-commits mailing list<br class="">
> <a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-commits</a><br class="">
<br class="">
<br class=""></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>