[PATCH] D45317: Canonicalization of the min/max patterns.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 5 06:09:26 PDT 2018
spatel added a comment.
In https://reviews.llvm.org/D45317#1058367, @spatel wrote:
> For reference, this pattern came up somewhere in the discussion leading up to https://reviews.llvm.org/D44266, but I can't remember exactly where.
>
> We can generalize this - you don't need a constant operand to the min/max for it to be a win:
> https://rise4fun.com/Alive/bftvin
I think I botched making the permalink:
https://rise4fun.com/Alive/nJp
Name: not_max_with_not_operand
%notx = xor i32 %x, -1
%cmp = icmp sgt i32 %notx, %y
%max = select i1 %cmp, i32 %notx, i32 %y
%res = xor i32 %max, -1
=>
%noty = xor i32 %y, -1
%cmp2 = icmp slt %x, %noty
%res = select i1 %cmp2, i32 %x, i32 %noty
Repository:
rL LLVM
https://reviews.llvm.org/D45317
More information about the llvm-commits
mailing list