[llvm] [VPlan] Fix classof() in VPWiden{Load|Store}Recipe NFC. (PR #119691)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 03:09:09 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-vectorizers

Author: Elvis Wang (ElvisWang123)

<details>
<summary>Changes</summary>

We should add VPWidenLoadEVLSC into classof VPWidenLoadRecipe and VPWidenStoreSC into VPWidenStoreRecipe.

---
Full diff: https://github.com/llvm/llvm-project/pull/119691.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/VPlan.h (+18-2) 


``````````diff
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); }

``````````

</details>


https://github.com/llvm/llvm-project/pull/119691


More information about the llvm-commits mailing list