[llvm] [LV] Stop using the legacy cost model for udiv + friends (PR #152707)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 23:06:54 PDT 2025


================
@@ -4278,6 +4278,26 @@ VectorizationFactor LoopVectorizationPlanner::selectVectorizationFactor() {
           if (!VPI)
             continue;
           switch (VPI->getOpcode()) {
+          // Selects are not modelled in the legacy cost model if they are
+          // inserted for reductions.
+          case Instruction::Select: {
+            VPValue *V =
+                R.getNumDefinedValues() == 1 ? R.getVPSingleValue() : nullptr;
+            if (V && V->getNumUsers() == 1) {
----------------
lukel97 wrote:

Is a VPInstruction not always a VPSingleDefRecipe? Does this work
```suggestion
            if (VPI->getVPSingleValue()->getNumUsers() == 1) {
```

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


More information about the llvm-commits mailing list