[all-commits] [llvm/llvm-project] a7f962: [InstCombine] Canonicalize `and(zext(A), B)` into ...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Thu Sep 28 11:52:13 PDT 2023


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/and-or-icmps.ll
    M llvm/test/Transforms/InstCombine/and.ll
    M llvm/test/Transforms/InstCombine/icmp.ll
    M llvm/test/Transforms/InstCombine/narrow.ll
    M llvm/test/Transforms/InstCombine/zext-or-icmp.ll

  Log Message:
  -----------
  [InstCombine] Canonicalize `and(zext(A), B)` into `select A, B & 1, 0` (#66740)

This patch canonicalizes the pattern `and(zext(A), B)` into `select A, B
& 1, 0`. Thus, we can reuse transforms `select B == even, B & 1, 0 -> 0`
and `select B == odd, B & 1, 0 -> zext(B == odd)` in `InstCombine`.
It is an alternative to #66676. 
Alive2: https://alive2.llvm.org/ce/z/598phE
Fixes #66733.
Fixes #66606.
Fixes #28612.




More information about the All-commits mailing list