[llvm] [VPlan] Replace VPRecipeOrVPValue with VP2VP recipe simplification. (PR #76090)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 28 06:38:33 PST 2023
================
@@ -806,6 +806,38 @@ static unsigned getOpcodeForRecipe(VPRecipeBase &R) {
/// Try to simplify recipe \p R.
static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
+ // Try to remove redundant blend recipes.
+ if (auto *Blend = dyn_cast<VPBlendRecipe>(&R)) {
+ if (Blend->getNumIncomingValues() == 1) {
+ Blend->replaceAllUsesWith(Blend->getIncomingValue(0));
+ Blend->eraseFromParent();
+ return;
+ }
+
----------------
ayalz wrote:
```suggestion
```
Single incoming is a corner case of all incomings being equal, can be left to be handled below.
Wonder if/where it actually occurs - lcssa/header phi's should remain intact.
All incomings being equal should be optimized at the scalar phi level - when such an initial VPlan will be made available.
https://github.com/llvm/llvm-project/pull/76090
More information about the llvm-commits
mailing list