[all-commits] [llvm/llvm-project] d9e1f9: [InstCombine] Fold icmp of truncated left shift

Sanjay Patel via All-commits all-commits at lists.llvm.org
Thu Sep 8 07:50:02 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9e1f9d7591b0d3e4df3c0e33ffd8984fb1632a5
      https://github.com/llvm/llvm-project/commit/d9e1f9d7591b0d3e4df3c0e33ffd8984fb1632a5
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

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

  Log Message:
  -----------
  [InstCombine] Fold icmp of truncated left shift

(trunc (1 << Y) to iN) == 0 --> Y u>= N
(trunc (1 << Y) to iN) != 0 --> Y u<  N

These can be generalized in several ways as noted by the TODO
items, but this handles the pattern in the motivating bug report.

Fixes #51889

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




More information about the All-commits mailing list