[llvm] [InstCombine] Fix transforms of two select patterns (PR #65845)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 09:00:05 PDT 2023


================
@@ -3086,17 +3086,18 @@ Instruction *InstCombinerImpl::foldSelectOfBools(SelectInst &SI) {
                                 m_c_LogicalOr(m_Deferred(A), m_Deferred(B)))))
     return BinaryOperator::CreateXor(A, B);
 
-  // select (~a | c), a, b -> and a, (or c, freeze(b))
+  // select (~a | c), a, b -> select a, (select c, true, b), false
   if (match(CondVal, m_c_Or(m_Not(m_Specific(TrueVal)), m_Value(C))) &&
       CondVal->hasOneUse()) {
----------------
goldsteinn wrote:

`match(CondVal, m_OneUse(m_c_Or(...)))` 

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


More information about the llvm-commits mailing list