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

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 07:00:11 PDT 2017


uweigand added a comment.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D32143





More information about the llvm-commits mailing list