[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 15:32:04 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:

This pattern is similar to, but more specific than, the one on line 3109. You should probably move this transform above that one.

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


More information about the llvm-commits mailing list