[InstCombine] fold add-carry of bools to logic
authorSanjay Patel <spatel@rotateright.com>
Tue, 6 Dec 2022 18:12:10 +0000 (13:12 -0500)
committerSanjay Patel <spatel@rotateright.com>
Tue, 6 Dec 2022 18:42:42 +0000 (13:42 -0500)
commit71df24dd39177ecfc440a04cd92fa4845d88347d
tree8caa43a03630dd6da5ddea2daf0a0d6dc821f196
parent924233c784fa782388475a4103ac9ac00bbe0e6f
[InstCombine] fold add-carry of bools to logic

((zext BoolX) + (zext BoolY)) >> 1 --> zext (BoolX && BoolY)
https://alive2.llvm.org/ce/z/LvZFKj

This was noted as a missing fold in D138814.
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/test/Transforms/InstCombine/lshr.ll