[llvm] [VPlan] Add missing const-qualifications (NFC) (PR #195248)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 03:46:25 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>



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


3 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/VPlan.h (+2-2) 
- (modified) llvm/lib/Transforms/Vectorize/VPlanUtils.cpp (+4-4) 
- (modified) llvm/lib/Transforms/Vectorize/VPlanUtils.h (+1-1) 


``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index ff056df396eb4..592d83af2295f 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -4606,8 +4606,8 @@ class VPlan {
 
   /// Returns the preheader of the vector loop region, if one exists, or null
   /// otherwise.
-  VPBasicBlock *getVectorPreheader() {
-    VPRegionBlock *VectorRegion = getVectorLoopRegion();
+  VPBasicBlock *getVectorPreheader() const {
+    const VPRegionBlock *VectorRegion = getVectorLoopRegion();
     return VectorRegion
                ? cast<VPBasicBlock>(VectorRegion->getSinglePredecessor())
                : nullptr;
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
index 0cb64b66e5ccd..a60b490a69ce6 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
@@ -396,14 +396,14 @@ bool vputils::isSingleScalar(const VPValue *VPV) {
   return isa<VPExpandSCEVRecipe>(VPV);
 }
 
-bool vputils::isUniformAcrossVFsAndUFs(VPValue *V) {
+bool vputils::isUniformAcrossVFsAndUFs(const VPValue *V) {
   // Live-ins and region values are uniform.
   if (isa<VPIRValue, VPSymbolicValue, VPRegionValue>(V))
     return true;
 
-  VPRecipeBase *R = V->getDefiningRecipe();
-  VPBasicBlock *VPBB = R ? R->getParent() : nullptr;
-  VPlan *Plan = VPBB ? VPBB->getPlan() : nullptr;
+  const VPRecipeBase *R = V->getDefiningRecipe();
+  const VPBasicBlock *VPBB = R ? R->getParent() : nullptr;
+  const VPlan *Plan = VPBB ? VPBB->getPlan() : nullptr;
   if (VPBB) {
     if ((VPBB == Plan->getVectorPreheader() || VPBB == Plan->getEntry())) {
       if (match(V->getDefiningRecipe(),
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.h b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
index 97ba1393a7f31..cf54b2b6ac963 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
@@ -62,7 +62,7 @@ bool isHeaderMask(const VPValue *V, const VPlan &Plan);
 /// as such if it is either loop invariant (defined outside the vector region)
 /// or its operands are known to be uniform across all VFs and UFs (e.g.
 /// VPDerivedIV or the canonical IV).
-bool isUniformAcrossVFsAndUFs(VPValue *V);
+bool isUniformAcrossVFsAndUFs(const VPValue *V);
 
 /// Returns the header block of the first, top-level loop, or null if none
 /// exist.

``````````

</details>


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


More information about the llvm-commits mailing list