[llvm] [InstCombine] Select of Symmetric Selects (PR #99245)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 05:50:42 PDT 2024
================
@@ -3012,6 +3012,32 @@ struct DecomposedSelect {
};
} // namespace
+/// Folds patterns like:
+/// select c2 (select c1 a b) (select c1 b a)
+/// into:
+/// select (xor c1 c2) b a
+static Instruction *
+foldSelectOfSymmetricSelect(SelectInst &OuterSelVal,
+ InstCombiner::BuilderTy &Builder) {
+
+ DecomposedSelect OuterSel, InnerSel;
----------------
dtcxzyw wrote:
`Value *OuterCond, *InnerCond, *InnerTrueVal, *InnerFalseVal` would be simpler :)
https://github.com/llvm/llvm-project/pull/99245
More information about the llvm-commits
mailing list