This allows easier access to the induction descriptor from VPlan,
without needing to go through Legal. VPReductionPHIRecipe already
contains a RecurrenceDescriptor in a similar fashion.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
|---|---|---|
| 8591 | This change from lookup() to find() is done in order to obtain a reference to an existing InductionDescriptor to be recorded in VPWidenIntOrFpInduction recipe, rather than a copy thereof. Right? Can alternatively do if (!Legal->isInductionPhi(Phi)) return nullptr; InductionDescriptor &II = Legal->getInductionVars().find(Phi)->second; | |
| 8623 | This is a similar setting of II as suggested above, but where checking isInductionPhi() is redundant. | |
| llvm/lib/Transforms/Vectorize/VPlan.h | ||
| 65 | Lex order | |
| 1068 | IndDesc >> Descriptor? | |
| llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp | ||
| 49 | A similar case, albeit w/o direct access to Legal. Optional<InductionDescriptor *> getInductionDescriptor(PHINode *Phi) {
if (!isInductionPhi(Phi))
return None;
return &getInductionVars().find(Phi)->second;
}or even Optional<InductionDescriptor *> getIntOrFpInductionDescriptor(PHINode *Phi) {
if (!isInductionPhi(Phi))
return None;
auto &ID = getInductionVars().find(Phi)->second;
if (ID.getKind() == InductionDescriptor::IK_IntInduction ||
ID.getKind() == InductionDescriptor::IK_FpInduction)
return &ID;
return None;
}? | |
| llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
|---|---|---|
| 8591 | I went ahead and added a getIntOrFpInductionDescriptor helper as suggested below. | |
| llvm/lib/Transforms/Vectorize/VPlan.h | ||
| 65 | Moved to correct position. | |
| 1068 | updated to getInductionDescriptor. | |
| llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp | ||
| 49 | I went ahead and added a getIntOrFpInductionDescriptor helper. It is used in LV and here. VPInstructionsToVPRecipes has been updated to take a function_ref to get use it. That should reduce duplication to a minimum | |
| llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h | ||
|---|---|---|
| 313 | Thanks, should be fixed in the committed version. | |
| llvm/lib/Transforms/Vectorize/VPlan.h | ||
| 1067 | Thanks, should be fixed in the committed version. | |
| llvm/lib/Transforms/Vectorize/VPlanTransforms.h | ||
| 26 | Thanks, should be fixed in the committed version. | |
[f]or