[llvm] [DA] Address followup comments on #128782 (PR #162645)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 9 05:32:28 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Ryotaro Kasuga (kasuga-fj)
<details>
<summary>Changes</summary>
This is a follow-up PR for post-commit comments in #<!-- -->128782 .
- Fix variable name to camel case.
- Change the output format to make it easier to handle with FileCheck.
- Regenerate assertions of regression tests.
---
Full diff: https://github.com/llvm/llvm-project/pull/162645.diff
4 Files Affected:
- (modified) llvm/include/llvm/Analysis/DependenceAnalysis.h (+4-4)
- (modified) llvm/lib/Analysis/DependenceAnalysis.cpp (+24-20)
- (modified) llvm/test/Analysis/DependenceAnalysis/PreliminaryNoValidityCheckFixedSize.ll (+1)
- (modified) llvm/test/Analysis/DependenceAnalysis/SameSDLoops.ll (+6-4)
``````````diff
diff --git a/llvm/include/llvm/Analysis/DependenceAnalysis.h b/llvm/include/llvm/Analysis/DependenceAnalysis.h
index a2ca695d5f750..18a8f8aabb44a 100644
--- a/llvm/include/llvm/Analysis/DependenceAnalysis.h
+++ b/llvm/include/llvm/Analysis/DependenceAnalysis.h
@@ -160,7 +160,7 @@ class LLVM_ABI Dependence {
/// getDVEntry - Returns the DV entry associated with a regular or a
/// SameSD level
- DVEntry getDVEntry(unsigned Level, bool isSameSD) const;
+ DVEntry getDVEntry(unsigned Level, bool IsSameSD) const;
/// getDirection - Returns the direction associated with a particular
/// common or SameSD level.
@@ -234,7 +234,7 @@ class LLVM_ABI Dependence {
/// dumpImp - For debugging purposes. Dumps a dependence to OS with or
/// without considering the SameSD levels.
- void dumpImp(raw_ostream &OS, bool SameSD = false) const;
+ void dumpImp(raw_ostream &OS, bool IsSameSD = false) const;
protected:
Instruction *Src, *Dst;
@@ -282,8 +282,8 @@ class LLVM_ABI FullDependence final : public Dependence {
/// getDVEntry - Returns the DV entry associated with a regular or a
/// SameSD level.
- DVEntry getDVEntry(unsigned Level, bool isSameSD) const {
- if (!isSameSD) {
+ DVEntry getDVEntry(unsigned Level, bool IsSameSD) const {
+ if (!IsSameSD) {
assert(0 < Level && Level <= Levels && "Level out of range");
return DV[Level - 1];
} else {
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 1f0da8d1830d3..163bb7d271efa 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -212,6 +212,15 @@ static void dumpExampleDependence(raw_ostream &OS, DependenceInfo *DA,
if (NormalizeResults && D->normalize(&SE))
OS << "normalized - ";
D->dump(OS);
+
+ unsigned SameSDLevels = D->getSameSDLevels();
+ if (SameSDLevels > 0) {
+ OS.indent(2) << "da analyze - assuming " << SameSDLevels
+ << " loop level(s) fused: ";
+ D->dumpImp(OS, true);
+ OS << "\n";
+ }
+
for (unsigned Level = 1; Level <= D->getLevels(); Level++) {
if (D->isSplitable(Level)) {
OS << " da analyze - split level = " << Level;
@@ -275,7 +284,7 @@ bool Dependence::isAnti() const {
// if no subscript in the source or destination mention the induction
// variable associated with the loop at this level.
// Leave this out of line, so it will serve as a virtual method anchor
-bool Dependence::isScalar(unsigned level, bool isSameSD) const { return false; }
+bool Dependence::isScalar(unsigned level, bool IsSameSD) const { return false; }
//===----------------------------------------------------------------------===//
// FullDependence methods
@@ -351,38 +360,38 @@ bool FullDependence::normalize(ScalarEvolution *SE) {
// getDirection - Returns the direction associated with a particular common or
// SameSD level.
-unsigned FullDependence::getDirection(unsigned Level, bool isSameSD) const {
- return getDVEntry(Level, isSameSD).Direction;
+unsigned FullDependence::getDirection(unsigned Level, bool IsSameSD) const {
+ return getDVEntry(Level, IsSameSD).Direction;
}
// Returns the distance (or NULL) associated with a particular common or
// SameSD level.
-const SCEV *FullDependence::getDistance(unsigned Level, bool isSameSD) const {
- return getDVEntry(Level, isSameSD).Distance;
+const SCEV *FullDependence::getDistance(unsigned Level, bool IsSameSD) const {
+ return getDVEntry(Level, IsSameSD).Distance;
}
// Returns true if a particular regular or SameSD level is scalar; that is,
// if no subscript in the source or destination mention the induction variable
// associated with the loop at this level.
-bool FullDependence::isScalar(unsigned Level, bool isSameSD) const {
- return getDVEntry(Level, isSameSD).Scalar;
+bool FullDependence::isScalar(unsigned Level, bool IsSameSD) const {
+ return getDVEntry(Level, IsSameSD).Scalar;
}
// Returns true if peeling the first iteration from this regular or SameSD
// loop level will break this dependence.
-bool FullDependence::isPeelFirst(unsigned Level, bool isSameSD) const {
- return getDVEntry(Level, isSameSD).PeelFirst;
+bool FullDependence::isPeelFirst(unsigned Level, bool IsSameSD) const {
+ return getDVEntry(Level, IsSameSD).PeelFirst;
}
// Returns true if peeling the last iteration from this regular or SameSD
// loop level will break this dependence.
-bool FullDependence::isPeelLast(unsigned Level, bool isSameSD) const {
- return getDVEntry(Level, isSameSD).PeelLast;
+bool FullDependence::isPeelLast(unsigned Level, bool IsSameSD) const {
+ return getDVEntry(Level, IsSameSD).PeelLast;
}
// Returns true if splitting loop will break the dependence.
-bool FullDependence::isSplitable(unsigned Level, bool isSameSD) const {
- return getDVEntry(Level, isSameSD).Splitable;
+bool FullDependence::isSplitable(unsigned Level, bool IsSameSD) const {
+ return getDVEntry(Level, IsSameSD).Splitable;
}
// inSameSDLoops - Returns true if this level is an SameSD level, i.e.,
@@ -689,11 +698,6 @@ void Dependence::dump(raw_ostream &OS) const {
else if (isInput())
OS << "input";
dumpImp(OS);
- unsigned SameSDLevels = getSameSDLevels();
- if (SameSDLevels > 0) {
- OS << "! / assuming " << SameSDLevels << " loop level(s) fused: ";
- dumpImp(OS, true);
- }
}
OS << "!\n";
@@ -706,13 +710,13 @@ void Dependence::dump(raw_ostream &OS) const {
// For debugging purposes. Dumps a dependence to OS with or without considering
// the SameSD levels.
-void Dependence::dumpImp(raw_ostream &OS, bool isSameSD) const {
+void Dependence::dumpImp(raw_ostream &OS, bool IsSameSD) const {
bool Splitable = false;
unsigned Levels = getLevels();
unsigned SameSDLevels = getSameSDLevels();
bool OnSameSD = false;
unsigned LevelNum = Levels;
- if (isSameSD)
+ if (IsSameSD)
LevelNum += SameSDLevels;
OS << " [";
for (unsigned II = 1; II <= LevelNum; ++II) {
diff --git a/llvm/test/Analysis/DependenceAnalysis/PreliminaryNoValidityCheckFixedSize.ll b/llvm/test/Analysis/DependenceAnalysis/PreliminaryNoValidityCheckFixedSize.ll
index e67cae7d39a75..1e51447b6e720 100644
--- a/llvm/test/Analysis/DependenceAnalysis/PreliminaryNoValidityCheckFixedSize.ll
+++ b/llvm/test/Analysis/DependenceAnalysis/PreliminaryNoValidityCheckFixedSize.ll
@@ -21,6 +21,7 @@ define void @p2(i64 %n, ptr %A, ptr %B) nounwind uwtable ssp {
; CHECK-NEXT: da analyze - none!
; CHECK-NEXT: Src: store i64 %i.011, ptr %arrayidx8, align 8 --> Dst: %0 = load i64, ptr %arrayidx17, align 8
; CHECK-NEXT: da analyze - flow [-3 -2]!
+; CHECK-NEXT: da analyze - assuming 1 loop level(s) fused: [-3 -2 -1]
; CHECK-NEXT: Src: store i64 %i.011, ptr %arrayidx8, align 8 --> Dst: store i64 %0, ptr %B.addr.24, align 8
; CHECK-NEXT: da analyze - confused!
; CHECK-NEXT: Src: %0 = load i64, ptr %arrayidx17, align 8 --> Dst: %0 = load i64, ptr %arrayidx17, align 8
diff --git a/llvm/test/Analysis/DependenceAnalysis/SameSDLoops.ll b/llvm/test/Analysis/DependenceAnalysis/SameSDLoops.ll
index f80e2cf5fd474..e893bb95502cb 100644
--- a/llvm/test/Analysis/DependenceAnalysis/SameSDLoops.ll
+++ b/llvm/test/Analysis/DependenceAnalysis/SameSDLoops.ll
@@ -18,7 +18,8 @@ define void @samebd0(ptr %A) nounwind uwtable ssp {
; CHECK-NEXT: Src: store i64 %i.013, ptr %arrayidx12, align 8 --> Dst: store i64 %i.013, ptr %arrayidx12, align 8
; CHECK-NEXT: da analyze - none!
; CHECK-NEXT: Src: store i64 %i.013, ptr %arrayidx12, align 8 --> Dst: store i64 %l17.04, ptr %arrayidx24, align 8
-; CHECK-NEXT: da analyze - output [-4 -3]! / assuming 2 loop level(s) fused: [-4 -3 -3 -1]!
+; CHECK-NEXT: da analyze - output [-4 -3]!
+; CHECK-NEXT: da analyze - assuming 2 loop level(s) fused: [-4 -3 -3 -1]
; CHECK-NEXT: Src: store i64 %l17.04, ptr %arrayidx24, align 8 --> Dst: store i64 %l17.04, ptr %arrayidx24, align 8
; CHECK-NEXT: da analyze - none!
;
@@ -96,7 +97,8 @@ define void @samebd1(ptr %A) nounwind uwtable ssp {
; CHECK-NEXT: Src: store i64 %i.03, ptr %arrayidx, align 4 --> Dst: store i64 %i.03, ptr %arrayidx, align 4
; CHECK-NEXT: da analyze - none!
; CHECK-NEXT: Src: store i64 %i.03, ptr %arrayidx, align 4 --> Dst: %0 = load i64, ptr %arrayidx7, align 4
-; CHECK-NEXT: da analyze - flow [|<]! / assuming 1 loop level(s) fused: [<=|<]!
+; CHECK-NEXT: da analyze - flow [|<]!
+; CHECK-NEXT: da analyze - assuming 1 loop level(s) fused: [<=|<]
; CHECK-NEXT: Src: %0 = load i64, ptr %arrayidx7, align 4 --> Dst: %0 = load i64, ptr %arrayidx7, align 4
; CHECK-NEXT: da analyze - none!
;
@@ -148,7 +150,7 @@ define void @non_samebd0(ptr %A) nounwind uwtable ssp {
; CHECK-NEXT: Src: store i64 %i.013, ptr %arrayidx12, align 8 --> Dst: store i64 %i.013, ptr %arrayidx12, align 8
; CHECK-NEXT: da analyze - none!
; CHECK-NEXT: Src: store i64 %i.013, ptr %arrayidx12, align 8 --> Dst: store i64 %l17.04, ptr %arrayidx24, align 8
-; CHECK-NEXT: da analyze - output [-4 -3]!{{$}}
+; CHECK-NEXT: da analyze - output [-4 -3]!
; CHECK-NEXT: Src: store i64 %l17.04, ptr %arrayidx24, align 8 --> Dst: store i64 %l17.04, ptr %arrayidx24, align 8
; CHECK-NEXT: da analyze - none!
;
@@ -227,7 +229,7 @@ define void @non_samebd1(ptr %A) nounwind uwtable ssp {
; CHECK-NEXT: Src: store i64 %i.03, ptr %arrayidx, align 4 --> Dst: store i64 %i.03, ptr %arrayidx, align 4
; CHECK-NEXT: da analyze - none!
; CHECK-NEXT: Src: store i64 %i.03, ptr %arrayidx, align 4 --> Dst: %0 = load i64, ptr %arrayidx7, align 4
-; CHECK-NEXT: da analyze - flow [|<]!{{$}}
+; CHECK-NEXT: da analyze - flow [|<]!
; CHECK-NEXT: Src: %0 = load i64, ptr %arrayidx7, align 4 --> Dst: %0 = load i64, ptr %arrayidx7, align 4
; CHECK-NEXT: da analyze - none!
;
``````````
</details>
https://github.com/llvm/llvm-project/pull/162645
More information about the llvm-commits
mailing list