[llvm] [VPlan] Unroll VPReplicateRecipe by VF. (PR #142433)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 03:35:35 PDT 2025


================
@@ -1147,6 +1147,23 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
     return;
   }
 
+  // Look through ExtractLastElement (BuildVector ....).
+  if (match(&R, m_VPInstruction<VPInstruction::ExtractLastElement>(
+                    m_BuildVector()))) {
+    auto *BuildVector = cast<VPInstruction>(R.getOperand(0));
+    Def->replaceAllUsesWith(
+        BuildVector->getOperand(BuildVector->getNumOperands() - 1));
+    return;
+  }
+  // Look through ExtractPenultimateElement (BuildVector ....).
----------------
ayalz wrote:

```suggestion
  }

  // Look through ExtractPenultimateElement (BuildVector ....).
```

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


More information about the llvm-commits mailing list