[llvm] [SelectionDAG][x86] Ensure vector reduction optimization (PR #144231)

Suhajda Tamás via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 17 11:34:12 PDT 2025


================
@@ -1435,6 +1435,20 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
       setOperationAction(ISD::BITREVERSE, VT, Custom);
   }
 
+  // Vector min/max reductions
+  if (Subtarget.hasSSE41())
+  {
+    for (MVT VT : MVT::vector_valuetypes()) {
----------------
sutajo wrote:

X86TTIImpl::shouldExpandReduction does a more thorough check. If we can't lower them properly they will get expanded to shuffles and we will never see these reductions in the DAG.

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


More information about the llvm-commits mailing list