[all-commits] [llvm/llvm-project] ff39b7: [InstCombine] Optimize (icmp slt (1 << Y), 1) -> (...

Craig Topper via All-commits all-commits at lists.llvm.org
Sat Jan 14 11:19:45 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff39b7ea89476c78177aff5cb0ddb441e74c8838
      https://github.com/llvm/llvm-project/commit/ff39b7ea89476c78177aff5cb0ddb441e74c8838
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-01-14 (Sat, 14 Jan 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp.ll

  Log Message:
  -----------
  [InstCombine] Optimize (icmp slt (1 << Y), 1) -> (icmp eq Y, BitWidth-1).

The code tried to do this for (icmp sle (1 << Y), 0), but that is
canonicalized to sgt before we get there.

Simplify the code by removing the unreachable SGE and SLE handling.

Also remove the (1 << Y) >=u 2147483648 and (1 << Y) <u 2147483648
handling since those are canonicalized to (1 << Y) <s 0 and
(1 << Y) >=s 0 before we get there.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D141753




More information about the All-commits mailing list