[all-commits] [llvm/llvm-project] 61d2f3: [InstCombine] Canonicalize icmp eq pow2 more thoro...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Mar 16 01:45:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 61d2f3a71e61929bf9b07c90e21d268090417bdb
      https://github.com/llvm/llvm-project/commit/61d2f3a71e61929bf9b07c90e21d268090417bdb
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-03-16 (Thu, 16 Mar 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/div.ll
    M llvm/test/Transforms/InstCombine/icmp-range.ll
    M llvm/test/Transforms/InstCombine/icmp-shl-nsw.ll
    M llvm/test/Transforms/InstCombine/icmp-shr-lt-gt.ll
    M llvm/test/Transforms/InstCombine/zext.ll

  Log Message:
  -----------
  [InstCombine] Canonicalize icmp eq pow2 more thoroughly

We currently already canonicalize icmp eq (%x & Pow2), Pow2 to
icmp ne (%x & Pow2), 0. This patch generalizes the fold based on
known bits.

In particular, this allows us to handle comparisons against
!range !{i64 0, i64 2} loads, which addresses an optimization
regression in Rust caused by 8df376db7282b955e7990cb8887ee9dcd3565040.

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




More information about the All-commits mailing list