[all-commits] [llvm/llvm-project] 8a7e54: [InstCombine] Canonicalize `(X +/- Y) & Y` into `~...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Thu Oct 12 02:18:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a7e5477982bcbfd46495e8e5e404fe43ad22d97
      https://github.com/llvm/llvm-project/commit/8a7e5477982bcbfd46495e8e5e404fe43ad22d97
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2023-10-12 (Thu, 12 Oct 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/and.ll

  Log Message:
  -----------
  [InstCombine] Canonicalize `(X +/- Y) & Y` into `~X & Y` when Y is a power of 2 (#67915)

This patch canonicalizes the pattern `(X +/- Y) & Y` into `~X & Y` when `Y` is a power of 2 or zero.
It will reduce the patterns to match in #67836 and exploit more optimization opportunities.
Alive2: https://alive2.llvm.org/ce/z/LBpvRF




More information about the All-commits mailing list