[llvm] [VPlan] Fix m_c_LogicalAnd/Or not working on commuted select operands (PR #213248)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 20:09:48 PDT 2026


================

----------------
lukel97 wrote:

FWIW, PatternMatch.h also has m_c_Select but with very different semantics. It commutes the operands without negating the condition.

```c++
/// Match Select(C, LHS, RHS) or Select(C, RHS, LHS)
template <typename LHS, typename RHS>
inline ThreeOps_match<decltype(m_Value()), LHS, RHS, Instruction::Select, true>
m_c_Select(const LHS &L, const RHS &R) {
  return ThreeOps_match<decltype(m_Value()), LHS, RHS, Instruction::Select,
                        true>(m_Value(), L, R);
}
```

https://github.com/llvm/llvm-project/pull/213248


More information about the llvm-commits mailing list