[InstCombine] Canonicalize (A & B_Pow2) eq/ne B_Pow2 patterns
authorNoah Goldstein <goldstein.w.n@gmail.com>
Mon, 9 Jan 2023 11:44:03 +0000 (12:44 +0100)
committerNikita Popov <npopov@redhat.com>
Mon, 9 Jan 2023 11:48:28 +0000 (12:48 +0100)
commit6d839621da8d0d85552c741c4c72369b4ada97c4
tree3338a7302e39dc17239181bb079a866e1ca800ea
parent747fc27ee44d934bc25ecc7a62b0c87fc3af1fd0
[InstCombine] Canonicalize (A & B_Pow2) eq/ne B_Pow2 patterns

1. A & B_Pow2 != B_Pow2 -> A & B_Pow2 == 0
   https://alive2.llvm.org/ce/z/KVUej4

2. A & B_Pow2 == B_Pow2 -> A & B_Pow2 != 0
   https://alive2.llvm.org/ce/z/PVv9FR

This allows the patterns to more easily be analyzed elsewhere.

Differential Revision: https://reviews.llvm.org/D141090
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-and-shift.ll