[llvm] [InstCombine] Fix profile propagation in foldNestedSelects (PR #229635)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 19:09:44 PDT 2026


================
@@ -3676,8 +3676,11 @@ static Instruction *foldNestedSelects(SelectInst &OuterSelVal,
     return nullptr;
 
   // Canonicalize inversion of the innermost `select`'s condition.
-  if (match(InnerSel.Cond, m_Not(m_Value(InnerSel.Cond))))
+  bool SwapInnerSelCond = false;
+  if (match(InnerSel.Cond, m_Not(m_Value(InnerSel.Cond)))) {
     std::swap(InnerSel.TrueVal, InnerSel.FalseVal);
+    SwapInnerSelCond = !SwapInnerSelCond;
----------------
mtrofin wrote:

why not just set to true here?

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


More information about the llvm-commits mailing list