[InstCombine] fold not-shift of signbit to icmp+zext, part 2
authorSanjay Patel <spatel@rotateright.com>
Sun, 8 Jan 2023 16:36:21 +0000 (11:36 -0500)
committerSanjay Patel <spatel@rotateright.com>
Sun, 8 Jan 2023 17:04:09 +0000 (12:04 -0500)
commit21d3871b7c90f85b3ae417724d7864369173bde0
tree2fa4ce5a9395c8bd7d0a082a8f67fd10df5e4179
parent310eea1c78e3e7aac7c016ab9bdf00d04f354645
[InstCombine] fold not-shift of signbit to icmp+zext, part 2

Follow-up to:
6c39a3aae1dc

That converted a pattern with ashr directly to icmp+zext, and
this updates the pattern that we used to convert to.

This canonicalizes to icmp for better analysis in the minimum case
and shortens patterns where the source type is not the same as dest type:
https://alive2.llvm.org/ce/z/tpXJ64
https://alive2.llvm.org/ce/z/dQ405O

This requires an adjustment to an icmp transform to avoid infinite looping.
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/test/Transforms/InstCombine/and-xor-merge.ll
llvm/test/Transforms/InstCombine/icmp-mul-zext.ll
llvm/test/Transforms/InstCombine/lshr.ll
llvm/test/Transforms/InstCombine/negated-bitmask.ll
llvm/test/Transforms/InstCombine/xor.ll
llvm/test/Transforms/InstCombine/zext.ll