[InstCombine] Support one-hot merge for logical and/or
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 11 May 2021 21:01:29 +0000 (23:01 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 12 May 2021 19:01:18 +0000 (21:01 +0200)
commita8f7dee1dffbf8c18acbcc7b1f6d659bf808798e
tree8b6ea115eebad97d46d78faf145002e2553398cf
parent99d63ccff04b672694f8a2b3eed024b873dc163d
[InstCombine] Support one-hot merge for logical and/or

If a logical and/or is used, we need to be careful not to propagate
a potential poison value from the RHS by inserting a freeze
instruction. Otherwise it works the same way as bitwise and/or.

This is intended to address the regression reported at
https://reviews.llvm.org/D101191#2751002.

Differential Revision: https://reviews.llvm.org/D102279
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/onehot_merge.ll