[llvm] [InstCombine] Optimize 'xor-and/or-select' sequence to 'or' for bool (PR #66394)

Bryan Chan via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 16:01:53 PDT 2023


================
@@ -3112,6 +3112,26 @@ Instruction *InstCombinerImpl::foldSelectOfBools(SelectInst &SI) {
     return SelectInst::Create(FalseVal, One, AndV);
   }
 
+  // select (~b & a), a, b -> or a, b
+  // only for scalar types
+  if (match(CondVal, m_c_And(m_Not(m_Specific(FalseVal)), m_Specific(TrueVal))) &&
----------------
bryanpkc wrote:

Correction: Both your patterns are more specific than the ones between lines 3089 and 3109. Move your code above those.

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


More information about the llvm-commits mailing list