Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/LoopInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ class LLVM_ABI LoopInfoWrapperPass : public FunctionPass {
};

/// Function to print a loop's contents as LLVM's text IR assembly.
LLVM_ABI void printLoop(Loop &L, raw_ostream &OS,
LLVM_ABI void printLoop(const Loop &L, raw_ostream &OS,
const std::string &Banner = "");

/// Find and return the loop attribute node for the attribute @p Name in
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/LoopInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,8 @@ PreservedAnalyses LoopPrinterPass::run(Function &F,
return PreservedAnalyses::all();
}

void llvm::printLoop(Loop &L, raw_ostream &OS, const std::string &Banner) {

void llvm::printLoop(const Loop &L, raw_ostream &OS,
const std::string &Banner) {
if (forcePrintModuleIR()) {
// handling -print-module-scope
OS << Banner << " (loop: ";
Expand Down
34 changes: 17 additions & 17 deletions llvm/lib/Transforms/Scalar/LoopFuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ struct FusionCandidate {
Valid = false;
}

bool reportInvalidCandidate(llvm::Statistic &Stat) const {
bool reportInvalidCandidate(Statistic &Stat) const {
using namespace ore;
assert(L && Preheader && "Fusion candidate not initialized properly!");
#if LLVM_ENABLE_STATS
Expand Down Expand Up @@ -445,6 +445,7 @@ struct FusionCandidateCompare {
"No dominance relationship between these fusion candidates!");
}
};
} // namespace

using LoopVector = SmallVector<Loop *, 4>;

Expand All @@ -461,9 +462,15 @@ using LoopVector = SmallVector<Loop *, 4>;
using FusionCandidateSet = std::set<FusionCandidate, FusionCandidateCompare>;
using FusionCandidateCollection = SmallVector<FusionCandidateSet, 4>;

#if !defined(NDEBUG)
static llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
const FusionCandidate &FC) {
#ifndef NDEBUG
static void printLoopVector(const LoopVector &LV) {
dbgs() << "****************************\n";
for (const Loop *L : LV)
printLoop(*L, dbgs());
dbgs() << "****************************\n";
}

static raw_ostream &operator<<(raw_ostream &OS, const FusionCandidate &FC) {
if (FC.isValid())
OS << FC.Preheader->getName();
else
Expand All @@ -472,8 +479,8 @@ static llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
return OS;
}

static llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
const FusionCandidateSet &CandSet) {
static raw_ostream &operator<<(raw_ostream &OS,
const FusionCandidateSet &CandSet) {
for (const FusionCandidate &FC : CandSet)
OS << FC << '\n';

Expand All @@ -489,7 +496,9 @@ printFusionCandidates(const FusionCandidateCollection &FusionCandidates) {
dbgs() << "****************************\n";
}
}
#endif
#endif // NDEBUG

namespace {

/// Collect all loops in function at the same nest level, starting at the
/// outermost level.
Expand Down Expand Up @@ -550,15 +559,6 @@ struct LoopDepthTree {
LoopsOnLevelTy LoopsOnLevel;
};

#ifndef NDEBUG
static void printLoopVector(const LoopVector &LV) {
dbgs() << "****************************\n";
for (auto *L : LV)
printLoop(*L, dbgs());
dbgs() << "****************************\n";
}
#endif

struct LoopFuser {
private:
// Sets of control flow equivalent fusion candidates for a given nest level.
Expand Down Expand Up @@ -1850,7 +1850,7 @@ struct LoopFuser {
/// <Cand1 Preheader> and <Cand2 Preheader>: <Stat Description>
template <typename RemarkKind>
void reportLoopFusion(const FusionCandidate &FC0, const FusionCandidate &FC1,
llvm::Statistic &Stat) {
Statistic &Stat) {
assert(FC0.Preheader && FC1.Preheader &&
"Expecting valid fusion candidates");
using namespace ore;
Expand Down