[llvm] [VPlan] Add initial anlysis to infer scalar type of VPValues. (PR #69013)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 23 09:52:54 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 8e2bd05c4e86834a318ef2279e271f0769be4988 4ed3b6dfe165aec75f4da8735d392c7aa7ee0822 -- llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp llvm/lib/Transforms/Vectorize/VPlanAnalysis.h llvm/lib/Transforms/Vectorize/VPlan.h llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
index f2e73ca4f63a..27794601fa45 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
@@ -166,12 +166,12 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
if (V->isLiveIn())
return V->getLiveInIRValue()->getType();
- const VPRecipeBase *Def = V->getDefiningRecipe();
- switch (Def->getVPDefID()) {
- case VPDef::VPCanonicalIVPHISC:
- case VPDef::VPFirstOrderRecurrencePHISC:
- case VPDef::VPReductionPHISC:
- case VPDef::VPWidenPointerInductionSC:
+ const VPRecipeBase *Def = V->getDefiningRecipe();
+ switch (Def->getVPDefID()) {
+ case VPDef::VPCanonicalIVPHISC:
+ case VPDef::VPFirstOrderRecurrencePHISC:
+ case VPDef::VPReductionPHISC:
+ case VPDef::VPWidenPointerInductionSC:
// Handle header phi recipes, except VPWienIntOrFpInduction which needs
// special handling due it being possibly truncated.
ResultTy = cast<VPHeaderPHIRecipe>(Def)
@@ -179,47 +179,47 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
->getLiveInIRValue()
->getType();
break;
- case VPDef::VPWidenIntOrFpInductionSC:
+ case VPDef::VPWidenIntOrFpInductionSC:
ResultTy = cast<VPWidenIntOrFpInductionRecipe>(Def)->getScalarType();
break;
- case VPDef::VPPredInstPHISC:
- case VPDef::VPScalarIVStepsSC:
- case VPDef::VPWidenPHISC:
+ case VPDef::VPPredInstPHISC:
+ case VPDef::VPScalarIVStepsSC:
+ case VPDef::VPWidenPHISC:
ResultTy = inferScalarType(Def->getOperand(0));
break;
- case VPDef::VPBlendSC:
+ case VPDef::VPBlendSC:
ResultTy = inferScalarType(cast<VPBlendRecipe>(Def));
break;
- case VPDef::VPInstructionSC:
+ case VPDef::VPInstructionSC:
ResultTy = inferScalarType(cast<VPInstruction>(Def));
break;
- case VPDef::VPInterleaveSC:
+ case VPDef::VPInterleaveSC:
// TODO: Use info from interleave group.
ResultTy = V->getUnderlyingValue()->getType();
break;
- case VPDef::VPReplicateSC:
+ case VPDef::VPReplicateSC:
ResultTy = inferScalarType(cast<VPReplicateRecipe>(Def));
break;
- case VPDef::VPWidenSC:
+ case VPDef::VPWidenSC:
ResultTy = inferScalarType(cast<VPWidenRecipe>(Def));
break;
- case VPDef::VPWidenCallSC:
+ case VPDef::VPWidenCallSC:
ResultTy = inferScalarType(cast<VPWidenCallRecipe>(Def));
break;
- case VPDef::VPWidenCastSC:
- ResultTy = cast<VPWidenCastRecipe>(Def)->getResultType();
- break;
- case VPDef::VPWidenGEPSC:
- ResultTy = PointerType::get(Ctx, 0);
- break;
- case VPDef::VPWidenMemoryInstructionSC:
- ResultTy = inferScalarType(cast<VPWidenMemoryInstructionRecipe>(Def));
- break;
- case VPDef::VPWidenSelectSC:
- ResultTy = inferScalarType(cast<VPWidenSelectRecipe>(Def));
- break;
- }
- assert(ResultTy && "could not infer type for the given VPValue");
- CachedTypes[V] = ResultTy;
- return ResultTy;
+ case VPDef::VPWidenCastSC:
+ ResultTy = cast<VPWidenCastRecipe>(Def)->getResultType();
+ break;
+ case VPDef::VPWidenGEPSC:
+ ResultTy = PointerType::get(Ctx, 0);
+ break;
+ case VPDef::VPWidenMemoryInstructionSC:
+ ResultTy = inferScalarType(cast<VPWidenMemoryInstructionRecipe>(Def));
+ break;
+ case VPDef::VPWidenSelectSC:
+ ResultTy = inferScalarType(cast<VPWidenSelectRecipe>(Def));
+ break;
+ }
+ assert(ResultTy && "could not infer type for the given VPValue");
+ CachedTypes[V] = ResultTy;
+ return ResultTy;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/69013
More information about the llvm-commits
mailing list