[all-commits] [llvm/llvm-project] d2abe8: [InstCombine] Fold `icmp eq/ne min|max(X, Y), Z` (...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Sun Sep 24 13:00:02 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d2abe8dc662a94e6c9aca5b64af53c7f815b5701
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2023-09-25 (Mon, 25 Sep 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/pr21199.ll
    M llvm/test/Transforms/InstCombine/smax-icmp.ll
    M llvm/test/Transforms/InstCombine/smin-icmp.ll
    M llvm/test/Transforms/InstCombine/umax-icmp.ll
    M llvm/test/Transforms/InstCombine/umin-icmp.ll

  Log Message:
  [InstCombine] Fold `icmp eq/ne min|max(X, Y), Z` (#67087)

This patch further improves the simplification of pattern `icmp eq/ne
min|max(X, Y), Z` as discussed in
When `X < Z`:
`min(X, Y) == Z -> false`
`min(X, Y) != Z -> true`
`max(X, Y) == Z -> Y == Z`
`max(Y, Z) != Z -> Y != Z`
When `X > Z`:
`max(X, Y) == Z -> false`
`max(X, Y) != Z -> true`
`min(X, Y) == Z -> Y == Z`
`min(Y, Z) != Z -> Y != Z`

Alive2:  https://alive2.llvm.org/ce/z/evkmaq

More information about the All-commits mailing list