[llvm-branch-commits] [llvm-branch] r323740 - Merging r322016:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 30 01:57:17 PST 2018
Author: hans
Date: Tue Jan 30 01:57:17 2018
New Revision: 323740
URL: http://llvm.org/viewvc/llvm-project?rev=323740&view=rev
Log:
Merging r322016:
------------------------------------------------------------------------
r322016 | spatel | 2018-01-08 19:31:13 +0100 (Mon, 08 Jan 2018) | 8 lines
[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/branches/release_60/ (props changed)
llvm/branches/release_60/lib/Analysis/ValueTracking.cpp
llvm/branches/release_60/test/Transforms/InstCombine/minmax-fold.ll
Propchange: llvm/branches/release_60/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 30 01:57:17 2018
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,321751,321789,321791,321806,321862,321870,321872,321878,321980,321991,321993-321994,322003,322053,322056,322103,322106,322108,322123,322131,322223,322272,322313,322372,322473,322623,322644,322724,322767,322875,322878-322879,322900,322904-322905,322973,322993,323034,323190,323307,323331,323369,323371,323384
+/llvm/trunk:155241,321751,321789,321791,321806,321862,321870,321872,321878,321980,321991,321993-321994,322003,322016,322053,322056,322103,322106,322108,322123,322131,322223,322272,322313,322372,322473,322623,322644,322724,322767,322875,322878-322879,322900,322904-322905,322973,322993,323034,323190,323307,323331,323369,323371,323384
Modified: llvm/branches/release_60/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_60/lib/Analysis/ValueTracking.cpp?rev=323740&r1=323739&r2=323740&view=diff
==============================================================================
--- llvm/branches/release_60/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/branches/release_60/lib/Analysis/ValueTracking.cpp Tue Jan 30 01:57:17 2018
@@ -4215,7 +4215,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/branches/release_60/test/Transforms/InstCombine/minmax-fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_60/test/Transforms/InstCombine/minmax-fold.ll?rev=323740&r1=323739&r2=323740&view=diff
==============================================================================
--- llvm/branches/release_60/test/Transforms/InstCombine/minmax-fold.ll (original)
+++ llvm/branches/release_60/test/Transforms/InstCombine/minmax-fold.ll Tue Jan 30 01:57:17 2018
@@ -899,3 +899,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
+}
+
More information about the llvm-branch-commits
mailing list