[PATCH] D127610: [InstCombine] Optimize shift+and+xor conversion pattern to simple comparison

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 14:10:55 PDT 2022


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/and.ll:1893
 
-; TODO: this pattern can be transform to icmp+select
-
 define i16 @shl_lshr_pow2_not_const_case2(i16 %x) {
 ; CHECK-LABEL: @shl_lshr_pow2_not_const_case2(
----------------
I don't see a good reason to canonicalize this to icmp+select, but leave the previous test as shift+and. 

We discussed transforming the simpler pattern starting with mask-by-power-of-2 in an earlier patch. I drafted a patch for that already and didn't notice any regressions. I will clean that up and post it for review.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127610/new/

https://reviews.llvm.org/D127610



More information about the llvm-commits mailing list