[llvm] [LoopInterchange] Mark getAddRecCoefficient with static (PR #203624)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 13:13:41 PDT 2026


https://github.com/kasuga-fj created https://github.com/llvm/llvm-project/pull/203624

As this function is a file-scope non-member function, it's better to mark it with static.

>From 072aa4c05f5e700310061c0764d622519d37b6d8 Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga <kasuga.ryotaro at fujitsu.com>
Date: Sat, 13 Jun 2026 05:12:02 +0900
Subject: [PATCH] [LoopInterchange] Mark getAddRecCoefficient with static

---
 llvm/lib/Transforms/Scalar/LoopInterchange.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
index 3da4e99860e45..4372269d1fc5f 100644
--- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
@@ -1666,8 +1666,8 @@ const DenseMap<const Loop *, unsigned> &CacheCostManager::getCostMap() {
 /// the addrec for \p L in \S.
 /// TODO: Handle more complex cases. Maybe using SCEVTraversal is a good way to
 /// do that.
-std::optional<const SCEV *> getAddRecCoefficient(ScalarEvolution &SE,
-                                                 const SCEV *S, const Loop *L) {
+static std::optional<const SCEV *>
+getAddRecCoefficient(ScalarEvolution &SE, const SCEV *S, const Loop *L) {
   const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(S);
   if (!AR) {
     if (SE.isLoopInvariant(S, L))



More information about the llvm-commits mailing list