[PATCH] D46827: [VPlan] Add VPInstruction to VPRecipe transformation.
    Diego Caballero via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Jun 15 09:11:40 PDT 2018
    
    
  
dcaballe added inline comments.
================
Comment at: lib/Transforms/Vectorize/VPlanHCFGTransforms.cpp:94
+      } else
+        NewRecipe = new VPWidenRecipe(Inst);
+
----------------
sguggill wrote:
> I think we are diverging from the nonVPlanNativePath case, where a widenRecipe can have > 1 ingredients but this should be fine.
You mean in line 95? I see. We shouldn't create unnecessary recipes if we can reuse an existing one. Could we do something similar to the code at the end of 'tryToWiden'?:
```
  // Success: widen this instruction. We optimize the common case where
  // consecutive instructions can be represented by a single recipe.
  if (!VPBB->empty()) {
    VPWidenRecipe *LastWidenRecipe = dyn_cast<VPWidenRecipe>(&VPBB->back());
    if (LastWidenRecipe && LastWidenRecipe->appendInstruction(I))
      return true;
  }
  VPBB->appendRecipe(new VPWidenRecipe(I));
```
https://reviews.llvm.org/D46827
    
    
More information about the llvm-commits
mailing list