[llvm] [DA] add debug log in findGCD (PR #189537)
Ruoyu Qiu via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 02:09:37 PDT 2026
https://github.com/cabbaken updated https://github.com/llvm/llvm-project/pull/189537
>From 1037b6f79fa7a94313c66709edda2c5ef46184e0 Mon Sep 17 00:00:00 2001
From: Ruoyu Qiu <cabbaken at outlook.com>
Date: Tue, 31 Mar 2026 05:36:08 +0000
Subject: [PATCH 1/2] [DA] add debug log in ExactRDIVtest
---
llvm/lib/Analysis/DependenceAnalysis.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 959299bed2521..fb9257465eaf1 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1959,7 +1959,7 @@ bool DependenceInfo::exactRDIVtest(const SCEV *SrcCoeff, const SCEV *DstCoeff,
LLVM_DEBUG(dbgs() << "\t DstConst = " << *DstConst << "\n");
++ExactRDIVapplications;
const SCEV *Delta = SE->getMinusSCEV(DstConst, SrcConst);
- LLVM_DEBUG(dbgs() << "\t Delta = " << *Delta << "\n");
+ LLVM_DEBUG(dbgs() << "\t Delta = " << *Delta << " = CM\n");
const SCEVConstant *ConstDelta = dyn_cast<SCEVConstant>(Delta);
const SCEVConstant *ConstSrcCoeff = dyn_cast<SCEVConstant>(SrcCoeff);
const SCEVConstant *ConstDstCoeff = dyn_cast<SCEVConstant>(DstCoeff);
>From a1af5c02091e18430264d78bf9ef7364f0f80028 Mon Sep 17 00:00:00 2001
From: Ruoyu Qiu <cabbaken at outlook.com>
Date: Wed, 1 Apr 2026 03:35:51 +0000
Subject: [PATCH 2/2] update
---
llvm/lib/Analysis/DependenceAnalysis.cpp | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index fb9257465eaf1..9131e459218e8 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1480,6 +1480,9 @@ bool DependenceInfo::weakCrossingSIVtest(const SCEVAddRecExpr *Src,
// algorithm doesn't overflow.
static bool findGCD(unsigned Bits, const APInt &AM, const APInt &BM,
const APInt &Delta, APInt &G, APInt &X, APInt &Y) {
+ LLVM_DEBUG(dbgs() << "\t AM = " << AM << "\n");
+ LLVM_DEBUG(dbgs() << "\t BM = " << BM << "\n");
+ LLVM_DEBUG(dbgs() << "\t Delta = " << Delta << "\n");
APInt A0(Bits, 1, true), A1(Bits, 0, true);
APInt B0(Bits, 0, true), B1(Bits, 1, true);
APInt G0 = AM.abs();
@@ -1629,8 +1632,8 @@ bool DependenceInfo::exactSIVtest(const SCEVAddRecExpr *Src,
const SCEV *DstCoeff = Dst->getStepRecurrence(*SE);
const SCEV *DstConst = Dst->getStart();
LLVM_DEBUG(dbgs() << "\tExact SIV test\n");
- LLVM_DEBUG(dbgs() << "\t SrcCoeff = " << *SrcCoeff << " = AM\n");
- LLVM_DEBUG(dbgs() << "\t DstCoeff = " << *DstCoeff << " = BM\n");
+ LLVM_DEBUG(dbgs() << "\t SrcCoeff = " << *SrcCoeff << "\n");
+ LLVM_DEBUG(dbgs() << "\t DstCoeff = " << *DstCoeff << "\n");
LLVM_DEBUG(dbgs() << "\t SrcConst = " << *SrcConst << "\n");
LLVM_DEBUG(dbgs() << "\t DstConst = " << *DstConst << "\n");
++ExactSIVapplications;
@@ -1953,13 +1956,13 @@ bool DependenceInfo::exactRDIVtest(const SCEV *SrcCoeff, const SCEV *DstCoeff,
return false;
LLVM_DEBUG(dbgs() << "\tExact RDIV test\n");
- LLVM_DEBUG(dbgs() << "\t SrcCoeff = " << *SrcCoeff << " = AM\n");
- LLVM_DEBUG(dbgs() << "\t DstCoeff = " << *DstCoeff << " = BM\n");
+ LLVM_DEBUG(dbgs() << "\t SrcCoeff = " << *SrcCoeff << "\n");
+ LLVM_DEBUG(dbgs() << "\t DstCoeff = " << *DstCoeff << "\n");
LLVM_DEBUG(dbgs() << "\t SrcConst = " << *SrcConst << "\n");
LLVM_DEBUG(dbgs() << "\t DstConst = " << *DstConst << "\n");
++ExactRDIVapplications;
const SCEV *Delta = SE->getMinusSCEV(DstConst, SrcConst);
- LLVM_DEBUG(dbgs() << "\t Delta = " << *Delta << " = CM\n");
+ LLVM_DEBUG(dbgs() << "\t Delta = " << *Delta << "\n");
const SCEVConstant *ConstDelta = dyn_cast<SCEVConstant>(Delta);
const SCEVConstant *ConstSrcCoeff = dyn_cast<SCEVConstant>(SrcCoeff);
const SCEVConstant *ConstDstCoeff = dyn_cast<SCEVConstant>(DstCoeff);
More information about the llvm-commits
mailing list