[llvm] [VPlan] Fix classof() in VPWiden{Load|Store}Recipe NFC. (PR #119691)
Elvis Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 03:08:35 PST 2024
https://github.com/ElvisWang123 created https://github.com/llvm/llvm-project/pull/119691
We should add VPWidenLoadEVLSC into classof VPWidenLoadRecipe and VPWidenStoreSC into VPWidenStoreRecipe.
>From c9066b3871ec4d04e6332217a2a193ffeab70d03 Mon Sep 17 00:00:00 2001
From: Elvis Wang <elvis.wang at sifive.com>
Date: Thu, 12 Dec 2024 03:04:52 -0800
Subject: [PATCH] [VPlan] Fix classof() in VPWiden{Load|Store}Recipe.
We should add VPWidenLoadEVLSC into classof VPWidenLoadRecipe and
VPWidenStoreSC into VPWidenStoreRecipe.
---
llvm/lib/Transforms/Vectorize/VPlan.h | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 8794517b777f3b..22ac166b213024 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -2966,7 +2966,15 @@ struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
getDebugLoc());
}
- VP_CLASSOF_IMPL(VPDef::VPWidenLoadSC);
+ static inline bool classof(const VPRecipeBase *R) {
+ return R->getVPDefID() == VPRecipeBase::VPWidenLoadSC ||
+ R->getVPDefID() == VPRecipeBase::VPWidenLoadEVLSC;
+ }
+
+ static inline bool classof(const VPUser *U) {
+ auto *R = dyn_cast<VPRecipeBase>(U);
+ return R && classof(R);
+ }
/// Generate a wide load or gather.
void execute(VPTransformState &State) override;
@@ -3043,7 +3051,15 @@ struct VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
Reverse, getDebugLoc());
}
- VP_CLASSOF_IMPL(VPDef::VPWidenStoreSC);
+ static inline bool classof(const VPRecipeBase *R) {
+ return R->getVPDefID() == VPRecipeBase::VPWidenStoreSC ||
+ R->getVPDefID() == VPRecipeBase::VPWidenStoreEVLSC;
+ }
+
+ static inline bool classof(const VPUser *U) {
+ auto *R = dyn_cast<VPRecipeBase>(U);
+ return R && classof(R);
+ }
/// Return the value stored by this recipe.
VPValue *getStoredValue() const { return getOperand(1); }
More information about the llvm-commits
mailing list