Coverage Report

Created: 2024-01-17 10:31

/src/llvm-project/llvm/lib/Transforms/Scalar/LoopAccessAnalysisPrinter.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- LoopAccessAnalysisPrinter.cpp - Loop Access Analysis Printer --------==//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h"
10
#include "llvm/ADT/PriorityWorklist.h"
11
#include "llvm/Analysis/LoopAccessAnalysis.h"
12
#include "llvm/Analysis/LoopInfo.h"
13
#include "llvm/Transforms/Utils/LoopUtils.h"
14
15
using namespace llvm;
16
17
#define DEBUG_TYPE "loop-accesses"
18
19
PreservedAnalyses LoopAccessInfoPrinterPass::run(Function &F,
20
0
                                                 FunctionAnalysisManager &AM) {
21
0
  auto &LAIs = AM.getResult<LoopAccessAnalysis>(F);
22
0
  auto &LI = AM.getResult<LoopAnalysis>(F);
23
0
  OS << "Printing analysis 'Loop Access Analysis' for function '" << F.getName()
24
0
     << "':\n";
25
26
0
  SmallPriorityWorklist<Loop *, 4> Worklist;
27
0
  appendLoopsToWorklist(LI, Worklist);
28
0
  while (!Worklist.empty()) {
29
0
    Loop *L = Worklist.pop_back_val();
30
0
    OS.indent(2) << L->getHeader()->getName() << ":\n";
31
0
    LAIs.getInfo(*L).print(OS, 4);
32
0
  }
33
0
  return PreservedAnalyses::all();
34
0
}