[llvm] af98b87 - [VPlan] Use range check in VPHeaderPHIRecipe::classof (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 28 07:55:23 PDT 2022
Author: Florian Hahn
Date: 2022-08-28T15:54:12+01:00
New Revision: af98b875e89e3b8071f4c617916b5b9590cc30cc
URL: https://github.com/llvm/llvm-project/commit/af98b875e89e3b8071f4c617916b5b9590cc30cc
DIFF: https://github.com/llvm/llvm-project/commit/af98b875e89e3b8071f4c617916b5b9590cc30cc.diff
LOG: [VPlan] Use range check in VPHeaderPHIRecipe::classof (NFC).
This addresses a suggestion to simplify the check from D131989. This
also makes it easier to ensure that VPHeaderPHIRecipe::classof checks
for all header phi ids.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanValue.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index eab122398c359..533ad295b732c 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1134,22 +1134,12 @@ class VPHeaderPHIRecipe : public VPRecipeBase, public VPValue {
/// Method to support type inquiry through isa, cast, and dyn_cast.
static inline bool classof(const VPRecipeBase *B) {
- return B->getVPDefID() == VPRecipeBase::VPCanonicalIVPHISC ||
- B->getVPDefID() == VPRecipeBase::VPActiveLaneMaskPHISC ||
- B->getVPDefID() == VPRecipeBase::VPFirstOrderRecurrencePHISC ||
- B->getVPDefID() == VPRecipeBase::VPReductionPHISC ||
- B->getVPDefID() == VPRecipeBase::VPWidenIntOrFpInductionSC ||
- B->getVPDefID() == VPRecipeBase::VPWidenPointerInductionSC ||
- B->getVPDefID() == VPRecipeBase::VPWidenPHISC;
+ return B->getVPDefID() >= VPRecipeBase::VPFirstHeaderPHISC &&
+ B->getVPDefID() <= VPRecipeBase::VPLastPHISC;
}
static inline bool classof(const VPValue *V) {
- return V->getVPValueID() == VPValue::VPVCanonicalIVPHISC ||
- V->getVPValueID() == VPValue::VPVActiveLaneMaskPHISC ||
- V->getVPValueID() == VPValue::VPVFirstOrderRecurrencePHISC ||
- V->getVPValueID() == VPValue::VPVReductionPHISC ||
- V->getVPValueID() == VPValue::VPVWidenIntOrFpInductionSC ||
- V->getVPValueID() == VPValue::VPVWidenPointerInductionSC ||
- V->getVPValueID() == VPValue::VPVWidenPHISC;
+ return V->getVPValueID() >= VPValue::VPVFirstHeaderPHISC &&
+ V->getVPValueID() <= VPValue::VPVLastPHISC;
}
/// Generate the phi nodes.
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index c99fae1b2ab46..3aac5dc70f84e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -102,14 +102,17 @@ class VPValue {
// Phi-like VPValues. Need to be kept together.
VPVBlendSC,
+ VPVPredInstPHI,
+ // Header-phi recipes. Need to be kept together.
VPVCanonicalIVPHISC,
VPVActiveLaneMaskPHISC,
VPVFirstOrderRecurrencePHISC,
VPVWidenPHISC,
VPVWidenIntOrFpInductionSC,
VPVWidenPointerInductionSC,
- VPVPredInstPHI,
VPVReductionPHISC,
+ VPVFirstHeaderPHISC = VPVCanonicalIVPHISC,
+ VPVLastPHISC = VPVReductionPHISC,
};
VPValue(Value *UV = nullptr, VPDef *Def = nullptr)
@@ -358,15 +361,17 @@ class VPDef {
// Phi-like recipes. Need to be kept together.
VPBlendSC,
+ VPPredInstPHISC,
+ // Header-phi recipes. Need to be kept together.
VPCanonicalIVPHISC,
VPActiveLaneMaskPHISC,
VPFirstOrderRecurrencePHISC,
VPWidenPHISC,
VPWidenIntOrFpInductionSC,
VPWidenPointerInductionSC,
- VPPredInstPHISC,
VPReductionPHISC,
VPFirstPHISC = VPBlendSC,
+ VPFirstHeaderPHISC = VPCanonicalIVPHISC,
VPLastPHISC = VPReductionPHISC,
};
More information about the llvm-commits
mailing list