[llvm] [InstCombine] Avoid folding `select(umin(X, Y), X)` with min/max values in false arm (PR #143020)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 13:07:40 PDT 2025


================
@@ -1719,6 +1719,13 @@ Instruction *InstCombinerImpl::FoldOpIntoSelect(Instruction &Op, SelectInst *SI,
   if (SI->getType()->isIntOrIntVectorTy(1))
     return nullptr;
 
+  if (isa<MinMaxIntrinsic>(&Op))
----------------
nikic wrote:

Add a comment here why we are doing this (avoid breaking min/max reduction pattern, which may prevent vectorization).

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


More information about the llvm-commits mailing list