[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)) {
+ // (A || B) || C --> A || (B | C)
+ return replaceInstUsesWith(
+ SI, Builder.CreateLogicalOp(Instruction::Or, A,
----------------
dtcxzyw wrote:
```suggestion
SI, Builder.CreateLogicalOr(A,
```
https://github.com/llvm/llvm-project/pull/86823
More information about the llvm-commits
mailing list