[InstCombine] Fold add of zext and sext of i1
authorNikita Popov <npopov@redhat.com>
Fri, 14 Jul 2023 12:41:33 +0000 (14:41 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 14 Jul 2023 12:52:13 +0000 (14:52 +0200)
commit21827268ada2ee62eaee49fcfa1133ed06a63d25
treedb297ac11f3c4ed5471ab8c73780a12d774523d9
parent893ad30d117b7af2416a022485ecb74793cd00f1
[InstCombine] Fold add of zext and sext of i1

(zext a) + (sext a) is 0 if a is a bool.

The regression is in a fuzzer-generated test.

Proof: https://alive2.llvm.org/ce/z/KotnN6
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/test/Transforms/InstCombine/add.ll
llvm/test/Transforms/InstCombine/shift.ll