https://bugs.llvm.org/show_bug.cgi?id=35834
Bug ID: 35834
Summary: [ValueTracking] recognize 'not' variant of min-of-min
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: spatel+l...@rotateright.com
CC: llvm-bugs@lists.llvm.org
Forking this off from bug 35717:
We have a pixel component min/max pattern in C as:
for (int i = 0; i < I; i++) {
xc = *A++;
xm = *A++;
xy = *A++;
xc = 255-xc;
xm = 255-xm;
xy = 255-xy;
if (xc < xm)
xk = xc < xy ? xc : xy;
else
xk = xm < xy ? xm : xy;
*B++ = xk;
}
----------------------------------------------------------------------------
Which currently optimizes to this IR:
define i8 @test(i8 %xc, i8 %xm, i8 %xy) {
%c0 = xor i8 %xc, -1
%m1 = xor i8 %xm, -1
%y2 = xor i8 %xy, -1
%cmp = icmp ult i8 %xm, %xc
%cmp13 = icmp ult i8 %c0, %y2
%cond = select i1 %cmp13, i8 %c0, i8 %y2
%cmp20 = icmp ult i8 %m1, %y2
%cond27 = select i1 %cmp20, i8 %m1, i8 %y2
%xk.0.in = select i1 %cmp, i8 %cond, i8 %cond27
ret i8 %xk.0.in
}
----------------------------------------------------------------------------
The 'not' of the compared ops is preventing recognition (and potential
simplification via https://reviews.llvm.org/D41603 ) of this chain of min/max.
We matched the simpler sequence with:
https://reviews.llvm.org/rL321672
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs