aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 2a322a6..389c3c7 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -591,20 +591,29 @@ bool RuntimePointerChecking::needsChecking(unsigned I, unsigned J) const {
return PointerI.AliasSetId == PointerJ.AliasSetId;
}
+/// Assign each RuntimeCheckingPtrGroup pointer an index for stable UTC output.
+static DenseMap<const RuntimeCheckingPtrGroup *, unsigned>
+getPtrToIdxMap(ArrayRef<RuntimeCheckingPtrGroup> CheckingGroups) {
+ DenseMap<const RuntimeCheckingPtrGroup *, unsigned> PtrIndices;
+ for (const auto &[Idx, CG] : enumerate(CheckingGroups))
+ PtrIndices[&CG] = Idx;
+ return PtrIndices;
+}
+
void RuntimePointerChecking::printChecks(
raw_ostream &OS, const SmallVectorImpl<RuntimePointerCheck> &Checks,
unsigned Depth) const {
unsigned N = 0;
+ auto PtrIndices = getPtrToIdxMap(CheckingGroups);
for (const auto &[Check1, Check2] : Checks) {
const auto &First = Check1->Members, &Second = Check2->Members;
-
OS.indent(Depth) << "Check " << N++ << ":\n";
-
- OS.indent(Depth + 2) << "Comparing group (" << Check1 << "):\n";
+ OS.indent(Depth + 2) << "Comparing group GRP" << PtrIndices.at(Check1)
+ << ":\n";
for (unsigned K : First)
OS.indent(Depth + 2) << *Pointers[K].PointerValue << "\n";
-
- OS.indent(Depth + 2) << "Against group (" << Check2 << "):\n";
+ OS.indent(Depth + 2) << "Against group GRP" << PtrIndices.at(Check2)
+ << ":\n";
for (unsigned K : Second)
OS.indent(Depth + 2) << *Pointers[K].PointerValue << "\n";
}
@@ -616,8 +625,9 @@ void RuntimePointerChecking::print(raw_ostream &OS, unsigned Depth) const {
printChecks(OS, Checks, Depth);
OS.indent(Depth) << "Grouped accesses:\n";
+ auto PtrIndices = getPtrToIdxMap(CheckingGroups);
for (const auto &CG : CheckingGroups) {
- OS.indent(Depth + 2) << "Group " << &CG << ":\n";
+ OS.indent(Depth + 2) << "Group GRP" << PtrIndices.at(&CG) << ":\n";
OS.indent(Depth + 4) << "(Low: " << *CG.Low << " High: " << *CG.High
<< ")\n";
for (unsigned Member : CG.Members) {