[InstCombine] remove casts from splat-a-bit pattern
authorSanjay Patel <spatel@rotateright.com>
Sun, 12 Sep 2021 13:18:14 +0000 (09:18 -0400)
committerSanjay Patel <spatel@rotateright.com>
Sun, 12 Sep 2021 13:18:14 +0000 (09:18 -0400)
commit3a126134d38144928de802bf96d45e72dd1b26d2
tree775a7893934ec96267471cb3ee8719268ef921bd
parentb78c85a44af300f8e3da582411814385cf70239d
[InstCombine] remove casts from splat-a-bit pattern

https://alive2.llvm.org/ce/z/_AivbM

This case seems clear since we can reduce instruction count
and avoid an intermediate type change, but we might want to
use mask-and-compare for other sequences.

Currently, we can generate more instructions on some related
patterns by trying to use bit-hacks instead of mask+cmp, so
something is not behaving as expected.
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/sext.ll