[llvm] [ValueTracking] Handle flipped strictness cases in `matchSelectPattern` (PR #121958)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 08:02:50 PST 2025


================
@@ -8488,6 +8488,20 @@ static SelectPatternResult matchMinMax(CmpInst::Predicate Pred,
   LHS = TrueVal;
   RHS = FalseVal;
 
+  // Handle constant RHS cases like X < 3 ? 2 : X -> max(X, 2)
+  auto *CmpRHSC = dyn_cast<ConstantInt>(CmpRHS);
----------------
nikic wrote:

Should handle vector constant as well?

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


More information about the llvm-commits mailing list