Skip to content

Conversation

@kasuga-fj
Copy link
Contributor

No description provided.

@llvmbot llvmbot added the llvm:analysis Includes value tracking, cost tables and constant folding label Dec 4, 2025
@kasuga-fj kasuga-fj enabled auto-merge (squash) December 4, 2025 10:17
@llvmbot
Copy link
Member

llvmbot commented Dec 4, 2025

@llvm/pr-subscribers-llvm-analysis

Author: Ryotaro Kasuga (kasuga-fj)

Changes

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

1 Files Affected:

  • (modified) llvm/lib/Analysis/DependenceAnalysis.cpp (+5-5)
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 7e908a3b73868..e6c535606812d 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -2470,7 +2470,7 @@ bool DependenceInfo::testMIV(const SCEV *Src, const SCEV *Dst,
 /// returns std::nullopt. For example, given (10 * X * Y)<nsw>, it returns 10.
 /// Notably, if it doesn't have nsw, the multiplication may overflow, and if
 /// so, it may not a multiple of 10.
-static std::optional<APInt> getConstanCoefficient(const SCEV *Expr) {
+static std::optional<APInt> getConstantCoefficient(const SCEV *Expr) {
   if (const auto *Constant = dyn_cast<SCEVConstant>(Expr))
     return Constant->getAPInt();
   if (const auto *Product = dyn_cast<SCEVMulExpr>(Expr))
@@ -2502,7 +2502,7 @@ bool DependenceInfo::accumulateCoefficientsGCD(const SCEV *Expr,
   if (AddRec->getLoop() == CurLoop) {
     CurLoopCoeff = Step;
   } else {
-    std::optional<APInt> ConstCoeff = getConstanCoefficient(Step);
+    std::optional<APInt> ConstCoeff = getConstantCoefficient(Step);
 
     // If the coefficient is the product of a constant and other stuff, we can
     // use the constant in the GCD computation.
@@ -2555,7 +2555,7 @@ bool DependenceInfo::gcdMIVtest(const SCEV *Src, const SCEV *Dst,
     const SCEV *Coeff = AddRec->getStepRecurrence(*SE);
     // If the coefficient is the product of a constant and other stuff,
     // we can use the constant in the GCD computation.
-    std::optional<APInt> ConstCoeff = getConstanCoefficient(Coeff);
+    std::optional<APInt> ConstCoeff = getConstantCoefficient(Coeff);
     if (!ConstCoeff)
       return false;
     RunningGCD = APIntOps::GreatestCommonDivisor(RunningGCD, ConstCoeff->abs());
@@ -2573,7 +2573,7 @@ bool DependenceInfo::gcdMIVtest(const SCEV *Src, const SCEV *Dst,
     const SCEV *Coeff = AddRec->getStepRecurrence(*SE);
     // If the coefficient is the product of a constant and other stuff,
     // we can use the constant in the GCD computation.
-    std::optional<APInt> ConstCoeff = getConstanCoefficient(Coeff);
+    std::optional<APInt> ConstCoeff = getConstantCoefficient(Coeff);
     if (!ConstCoeff)
       return false;
     RunningGCD = APIntOps::GreatestCommonDivisor(RunningGCD, ConstCoeff->abs());
@@ -2631,7 +2631,7 @@ bool DependenceInfo::gcdMIVtest(const SCEV *Src, const SCEV *Dst,
     Delta = SE->getMinusSCEV(SrcCoeff, DstCoeff);
     // If the coefficient is the product of a constant and other stuff,
     // we can use the constant in the GCD computation.
-    std::optional<APInt> ConstCoeff = getConstanCoefficient(Delta);
+    std::optional<APInt> ConstCoeff = getConstantCoefficient(Delta);
     if (!ConstCoeff)
       // The difference of the two coefficients might not be a product
       // or constant, in which case we give up on this direction.

@kasuga-fj kasuga-fj merged commit 11b1bd5 into llvm:main Dec 4, 2025
11 of 12 checks passed
@kasuga-fj kasuga-fj deleted the da-fix-typo branch December 4, 2025 10:44
kcloudy0717 pushed a commit to kcloudy0717/llvm-project that referenced this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:analysis Includes value tracking, cost tables and constant folding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants