[llvm] [InstCombine] Reduce nested logical operator if poison is implied (PR #86823)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 27 09:39:40 PDT 2024
================
@@ -2985,6 +2985,14 @@ Instruction *InstCombinerImpl::foldSelectOfBools(SelectInst &SI) {
return BinaryOperator::CreateOr(CondVal, FalseVal);
}
+ if (match(CondVal, m_LogicalOr(m_Value(A), m_Value(B))) &&
+ isa<SelectInst>(CondVal) && impliesPoison(FalseVal, B)) {
----------------
dtcxzyw wrote:
```suggestion
if (match(CondVal, m_Select(m_Value(A), m_One(), m_Value(B))) && impliesPoison(FalseVal, B)) {
```
Please add some negative tests:
+ multi-use
+ bitwise or
https://github.com/llvm/llvm-project/pull/86823
More information about the llvm-commits
mailing list