[llvm] r322016 - [ValueTracking] remove overzealous assert
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 01:59:25 PST 2018
Merged to 6.0 in r323740.
On Mon, Jan 8, 2018 at 7:31 PM, Sanjay Patel via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: spatel
> Date: Mon Jan 8 10:31:13 2018
> New Revision: 322016
>
> URL: http://llvm.org/viewvc/llvm-project?rev=322016&view=rev
> Log:
> [ValueTracking] remove overzealous assert
>
> The test is derived from a failing fuzz test:
> https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5008
>
> Credit to @rksimon for pointing out the problem.
>
>
> Modified:
> llvm/trunk/lib/Analysis/ValueTracking.cpp
> llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll
>
> Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> Analysis/ValueTracking.cpp?rev=322016&r1=322015&r2=322016&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
> +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Jan 8 10:31:13 2018
> @@ -4214,7 +4214,7 @@ static SelectPatternResult matchMinMaxOf
> break;
> return {SPF_UNKNOWN, SPNB_NA, false};
> default:
> - llvm_unreachable("Bad flavor while matching min/max");
> + return {SPF_UNKNOWN, SPNB_NA, false};
> }
>
> // a pred c ? m(a, b) : m(c, b) --> m(m(a, b), m(c, b))
>
> Modified: llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> Transforms/InstCombine/minmax-fold.ll?rev=322016&r1=322015&
> r2=322016&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll (original)
> +++ llvm/trunk/test/Transforms/InstCombine/minmax-fold.ll Mon Jan 8
> 10:31:13 2018
> @@ -887,3 +887,24 @@ define i32 @common_factor_umax_extra_use
> ret i32 %max_abc
> }
>
> +; This would assert. Don't assume that earlier min/max types match a
> possible later min/max.
> +
> +define float @not_min_of_min(i8 %i, float %x) {
> +; CHECK-LABEL: @not_min_of_min(
> +; CHECK-NEXT: [[CMP1_INV:%.*]] = fcmp fast oge float [[X:%.*]],
> 1.000000e+00
> +; CHECK-NEXT: [[MIN1:%.*]] = select i1 [[CMP1_INV]], float
> 1.000000e+00, float [[X]]
> +; CHECK-NEXT: [[CMP2_INV:%.*]] = fcmp fast oge float [[X]],
> 2.000000e+00
> +; CHECK-NEXT: [[MIN2:%.*]] = select i1 [[CMP2_INV]], float
> 2.000000e+00, float [[X]]
> +; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i8 [[I:%.*]], 16
> +; CHECK-NEXT: [[R:%.*]] = select i1 [[CMP3]], float [[MIN1]], float
> [[MIN2]]
> +; CHECK-NEXT: ret float [[R]]
> +;
> + %cmp1 = fcmp fast ult float %x, 1.0
> + %min1 = select i1 %cmp1, float %x, float 1.0
> + %cmp2 = fcmp fast ult float %x, 2.0
> + %min2 = select i1 %cmp2, float %x, float 2.0
> + %cmp3 = icmp ult i8 %i, 16
> + %r = select i1 %cmp3, float %min1, float %min2
> + ret float %r
> +}
> +
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180130/55c16dad/attachment-0001.html>
More information about the llvm-commits
mailing list