aqjune added a comment.

Seems like a bug in instsimplify:

  define i1 @f(i32 %x, i32 %y) {
    %cmp9.not.1 = icmp eq i32 %x, %y
    %cmp15      = icmp slt i32 %x, %y
    %spec.select39 = select i1 %cmp9.not.1, i1 undef, i1 %cmp15
    %spec.select40 = xor i1 %cmp9.not.1, 1
    %spec.select  = and i1 %spec.select39, %spec.select40
    ret i1 %spec.select
  }
  =>
  define i1 @f(i32 %x, i32 %y) {
    %cmp9.not.1 = icmp eq i32 %x, %y
    %cmp15 = icmp slt i32 %x, %y
    %spec.select39 = select i1 %cmp9.not.1, i1 undef, i1 %cmp15
    ret i1 %spec.select39
  }

https://godbolt.org/z/a8f7hT

Alive2 says it's incorrect: https://alive2.llvm.org/ce/z/-8Q4HL

Seems to be related with ValueTracking's isImpliedCondition since this 
optimizations happens only when operands of the two icmps are the same.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83360/new/

https://reviews.llvm.org/D83360



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to