[PATCH] D32143: [InstSimplify] use ConstantRange to simplify more and-of-icmps

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 07:17:49 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D32143#757324, @uweigand wrote:

> I'm seeing a performance regression which I traced back to this commit.   A reduced test case to show the problem is this:
>
>   define i1 @test(i64 %a) {
>     %cmpge = icmp sge i64 %a, 1
>     %cmpeq = icmp eq i64 %a, 1
>     %cmpne = icmp eq i1 %cmpeq, false
>     %cmp = and i1 %cmpge, %cmpne
>     ret i1 %cmp
>   }
>
>
> Before this commit, InstCombine would reduce the above to simply:
>
>   define i1 @test(i64 %a) {
>     %1 = icmp sgt i64 %a, 1
>     ret i1 %1
>   }
>
>
> but for some reason this no longer happens now.
>
> Note that when directly using an "icmp ne" instead of inverting the result of the "icmp eq", the optimization does still happen.


Thanks for the small test. I'll take a look.


Repository:
  rL LLVM

https://reviews.llvm.org/D32143





More information about the llvm-commits mailing list