[PATCH] D129436: [LV] Use PHI recipe instead of PredRecipe for subsequent uses.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 09:04:41 PDT 2022


fhahn marked 3 inline comments as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8409
                                        IsUniform, IsPredicated);
-  setRecipe(I, Recipe);
   Plan->addVPValue(I, Recipe);
 
----------------
Ayal wrote:
> This addVPValue was next to setRecipe; could it too sink to remain next to it?
Ah yes, this can be sunk, removing the need for the later removeVPValue!


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8448
 VPRegionBlock *VPRecipeBuilder::createReplicateRegion(
     Instruction *Instr, VPReplicateRecipe *PredRecipe, VPlanPtr &Plan) {
   // Instructions marked for predication are replicated and placed under an
----------------
Ayal wrote:
> nit: can avoid passing Instr given that it's underlying PredRecipe.
Simplified, thanks!


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8449
+    Plan->removeVPValueFor(Instr);
+    Plan->addVPValue(Instr, PHIRecipe);
+  } else
----------------
Ayal wrote:
> fhahn wrote:
> > Ayal wrote:
> > > Re-associating Instr with PHIRecipe instead of some previous VPValue (i.e., PredRecipe) via removeVPValueFor()/addVPValue() in order to affect subsequent get[OrAdd]VPValue()'s, seems aligned with re-associating setRecipe() to affect subsequent getRecipe()'s. Should we retain the initial setRecipe() which aligns with initial addVPValue(), and introduce the ability to resetRecipe() here? Can also replace removeVPValue()(+addVPValue()) with replaceVPValue(). The other (two) instances of removeVPValue()/addVPValue() pairs, namely adjustRecipesForReductions() and when transforming InterleaveGroups, should not resetRecipe(), right?
> > > 
> > > 
> > Adding a `resetRecipe` would be an option, but resetting a VPValue/recipe should only be an exception. In this case it seems cleaner to just delay setting it. WDYT?
> Agreed, but would be good to align (re)setRecipe with (remove)addVPValue; could the latter also be delayed, considering the cleaned-up call to getOrAddVPValue?
In the latest version there's no need for resetting, as the addVPValue can also be delayed until this point.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129436/new/

https://reviews.llvm.org/D129436



More information about the llvm-commits mailing list