[llvm] [DA] Extract duplicated logic from gcdMIVtest (PR #152688)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 8 06:47:31 PDT 2025
================
@@ -2345,6 +2345,43 @@ static std::optional<APInt> getConstantPart(const SCEV *Expr) {
return std::nullopt;
}
+bool DependenceInfo::accumulateCoefficientsGCD(const SCEV *Expr,
+ const Loop *CurLoop,
+ const SCEV *&CurLoopCoeff,
+ APInt &RunningGCD) const {
+ // If RunningGCD is already 1, exit early.
+ // TODO: It might be better to continue the recursion to find CurLoopCoeff.
----------------
kasuga-fj wrote:
This seems pretty buggy. Considering that `DstCoeff` is initialized to something like zero, we may not be able to distinguish between the case where `Dst` is invariant in `CurLoop` and the case where `Dst` is NOT invariant but the GCD is 1.
https://github.com/llvm/llvm-project/pull/152688
More information about the llvm-commits
mailing list