[llvm] 7b94dd3 - [VPLan] Reduce duplication in VPHeaderPHIRecipe::classof. (NFCI)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 19 04:47:23 PST 2025
Author: Florian Hahn
Date: 2025-11-19T12:46:53Z
New Revision: 7b94dd336e25b18e05b3b1f20360df81e4900ffb
URL: https://github.com/llvm/llvm-project/commit/7b94dd336e25b18e05b3b1f20360df81e4900ffb
DIFF: https://github.com/llvm/llvm-project/commit/7b94dd336e25b18e05b3b1f20360df81e4900ffb.diff
LOG: [VPLan] Reduce duplication in VPHeaderPHIRecipe::classof. (NFCI)
Implement VPHeaderPHIRecipe::classof(const VPValue *V) in terms of the
variant taking VPRecipeBase.
Reduces some duplication, split off from
https://github.com/llvm/llvm-project/pull/141431.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index faa353cc5a6cc..13582f8bd2d62 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -2065,14 +2065,12 @@ class LLVM_ABI_FOR_TEST VPHeaderPHIRecipe : public VPSingleDefRecipe,
~VPHeaderPHIRecipe() override = default;
/// Method to support type inquiry through isa, cast, and dyn_cast.
- static inline bool classof(const VPRecipeBase *B) {
- return B->getVPDefID() >= VPDef::VPFirstHeaderPHISC &&
- B->getVPDefID() <= VPDef::VPLastHeaderPHISC;
+ static inline bool classof(const VPRecipeBase *R) {
+ return R->getVPDefID() >= VPDef::VPFirstHeaderPHISC &&
+ R->getVPDefID() <= VPDef::VPLastHeaderPHISC;
}
static inline bool classof(const VPValue *V) {
- auto *B = V->getDefiningRecipe();
- return B && B->getVPDefID() >= VPRecipeBase::VPFirstHeaderPHISC &&
- B->getVPDefID() <= VPRecipeBase::VPLastHeaderPHISC;
+ return isa<VPHeaderPHIRecipe>(V->getDefiningRecipe());
}
/// Generate the phi nodes.
More information about the llvm-commits
mailing list