[InstCombine] Support logical and in masked icmp fold
authorNikita Popov <npopov@redhat.com>
Tue, 24 May 2022 08:45:29 +0000 (10:45 +0200)
committerNikita Popov <npopov@redhat.com>
Tue, 24 May 2022 09:16:33 +0000 (11:16 +0200)
commita7c079aaa227d55ad9cb6b916500d99b4fdf26d2
tree11d0c4554a7065f28af60e7f2e03bd5a12aa6e62
parent4aa32e1b17da4d29fe2db0fe1cfb0171243b4fed
[InstCombine] Support logical and in masked icmp fold

Most of the folds implemented in this function work fine with
logical operations. We only need to be careful for the cases that
work on non-constant masks, where the RHS operand shouldn't be
poison.

This is a conservative implementation that bails out of illegal
transforms, but we could also change these to insert freeze instead.
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/and-or-icmps.ll