[llvm] [VPlan][NFC] Make VPValue pointer const. (PR #101334)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 06:57:24 PDT 2024


https://github.com/Mel-Chen created https://github.com/llvm/llvm-project/pull/101334

None

>From 3b4e60139060a8d43b2693df4d44d094f6f72ff3 Mon Sep 17 00:00:00 2001
From: Mel Chen <mel.chen at sifive.com>
Date: Wed, 31 Jul 2024 06:47:43 -0700
Subject: [PATCH] [VPlan][NFC] Make VPValue pointer const.

---
 llvm/lib/Transforms/Vectorize/VPlan.cpp | 2 +-
 llvm/lib/Transforms/Vectorize/VPlan.h   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 58de6256900f0..2a9e4e12190cd 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -1624,7 +1624,7 @@ VPValue *vputils::getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr,
   return Expanded;
 }
 
-bool vputils::isHeaderMask(VPValue *V, VPlan &Plan) {
+bool vputils::isHeaderMask(const VPValue *V, VPlan &Plan) {
   if (isa<VPActiveLaneMaskPHIRecipe>(V))
     return true;
 
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index c9da5e5d38a6b..e65184aba6c3f 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -3799,12 +3799,12 @@ VPValue *getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr,
                                        ScalarEvolution &SE);
 
 /// Returns true if \p VPV is uniform after vectorization.
-inline bool isUniformAfterVectorization(VPValue *VPV) {
+inline bool isUniformAfterVectorization(const VPValue *VPV) {
   // A value defined outside the vector region must be uniform after
   // vectorization inside a vector region.
   if (VPV->isDefinedOutsideVectorRegions())
     return true;
-  VPRecipeBase *Def = VPV->getDefiningRecipe();
+  const VPRecipeBase *Def = VPV->getDefiningRecipe();
   assert(Def && "Must have definition for value defined inside vector region");
   if (auto Rep = dyn_cast<VPReplicateRecipe>(Def))
     return Rep->isUniform();
@@ -3816,7 +3816,7 @@ inline bool isUniformAfterVectorization(VPValue *VPV) {
 }
 
 /// Return true if \p V is a header mask in \p Plan.
-bool isHeaderMask(VPValue *V, VPlan &Plan);
+bool isHeaderMask(const VPValue *V, VPlan &Plan);
 } // end namespace vputils
 
 } // end namespace llvm



More information about the llvm-commits mailing list