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

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 19:58:32 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;
----------------
boomanaiden154 wrote:

I felt it was better to be consistent with the branch below where we need to invert.

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


More information about the llvm-commits mailing list