diff --git a/llvm/tools/llvm-mca/PipelinePrinter.cpp b/llvm/tools/llvm-mca/PipelinePrinter.cpp --- a/llvm/tools/llvm-mca/PipelinePrinter.cpp +++ b/llvm/tools/llvm-mca/PipelinePrinter.cpp @@ -59,7 +59,7 @@ for (unsigned J = 0; J < NumUnits; ++J) { std::string ResourceName = ProcResource.Name; if (NumUnits > 1) { - ResourceName += "."; + ResourceName += "."; ResourceName += J; } diff --git a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.h b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.h --- a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.h +++ b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.h @@ -33,9 +33,9 @@ /// In particular, this occurs when there is a delta between the number of uOps /// dispatched and the number of uOps issued to the underlying pipelines. /// -/// The bottleneck analysis view is also responsible for identifying and printing -/// the most "critical" sequence of dependent instructions according to the -/// simulated run. +/// The bottleneck analysis view is also responsible for identifying and +/// printing the most "critical" sequence of dependent instructions according to +/// the simulated run. /// /// Below is the critical sequence computed for the dot-product example on /// btver2: @@ -62,13 +62,14 @@ /// and edges of the graph represent data dependencies or processor resource /// interferences. /// -/// Edges are dynamically 'discovered' by observing instruction state transitions -/// and backend pressure increase events. Edges are internally ranked based on -/// their "criticality". A dependency is considered to be critical if it takes a -/// long time to execute, and if it contributes to backend pressure increases. -/// Criticality is internally measured in terms of cycles; it is computed for -/// every edge in the graph as a function of the edge latency and the number of -/// backend pressure increase cycles contributed by that edge. +/// Edges are dynamically 'discovered' by observing instruction state +/// transitions and backend pressure increase events. Edges are internally +/// ranked based on their "criticality". A dependency is considered to be +/// critical if it takes a long time to execute, and if it contributes to +/// backend pressure increases. Criticality is internally measured in terms of +/// cycles; it is computed for every edge in the graph as a function of the edge +/// latency and the number of backend pressure increase cycles contributed by +/// that edge. /// /// At the end of simulation, costs are propagated to nodes through the edges of /// the graph, and the most expensive path connecting the root-set (a @@ -217,8 +218,8 @@ // Loop carried dependencies are carefully expanded by the bottleneck analysis // to guarantee that the graph stays acyclic. To this end, extra nodes are // pre-allocated at construction time to describe instructions from "past and -// future" iterations. The graph is kept acyclic mainly because it simplifies the -// complexity of the algorithm that computes the critical sequence. +// future" iterations. The graph is kept acyclic mainly because it simplifies +// the complexity of the algorithm that computes the critical sequence. class DependencyGraph { struct DGNode { unsigned NumPredecessors; @@ -239,7 +240,8 @@ void pruneEdges(unsigned Iterations); void initializeRootSet(SmallVectorImpl &RootSet) const; - void propagateThroughEdges(SmallVectorImpl &RootSet, unsigned Iterations); + void propagateThroughEdges(SmallVectorImpl &RootSet, + unsigned Iterations); #ifndef NDEBUG void dumpDependencyEdge(raw_ostream &OS, const DependencyEdge &DE, diff --git a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp --- a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp +++ b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp @@ -198,8 +198,8 @@ } } -void DependencyGraph::propagateThroughEdges( - SmallVectorImpl &RootSet, unsigned Iterations) { +void DependencyGraph::propagateThroughEdges(SmallVectorImpl &RootSet, + unsigned Iterations) { SmallVector ToVisit; // A critical sequence is computed as the longest path from a node of the @@ -221,14 +221,14 @@ // The `unvisited nodes` set initially contains all the nodes from the // RootSet. A node N is added to the `unvisited nodes` if all its // predecessors have been visited already. - // + // // For simplicity, every node tracks the number of unvisited incoming edges in // field `NumVisitedPredecessors`. When the value of that field drops to // zero, then the corresponding node is added to a `ToVisit` set. // // At the end of every iteration of the outer loop, set `ToVisit` becomes our // new `unvisited nodes` set. - // + // // The algorithm terminates when the set of unvisited nodes (i.e. our RootSet) // is empty. This algorithm works under the assumption that the graph is // acyclic. @@ -267,8 +267,9 @@ // that node is the last instruction of our critical sequence. // Field N.Depth would tell us the total length of the sequence. // - // To obtain the sequence of critical edges, we simply follow the chain of critical - // predecessors starting from node N (field DGNode::CriticalPredecessor). + // To obtain the sequence of critical edges, we simply follow the chain of + // critical predecessors starting from node N (field + // DGNode::CriticalPredecessor). const auto It = std::max_element( Nodes.begin(), Nodes.end(), [](const DGNode &Lhs, const DGNode &Rhs) { return Lhs.Cost < Rhs.Cost; }); diff --git a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp --- a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp @@ -1,5 +1,4 @@ -//===--------------------- DispatchStatistics.cpp ---------------------*- C++ -//-*-===// +//===--------------------- DispatchStatistics.cpp ---------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/llvm/tools/llvm-mca/Views/InstructionView.h b/llvm/tools/llvm-mca/Views/InstructionView.h --- a/llvm/tools/llvm-mca/Views/InstructionView.h +++ b/llvm/tools/llvm-mca/Views/InstructionView.h @@ -1,4 +1,4 @@ -//===----------------------- InstrucionView.h -----------------------------*- C++ -*-===// +//===----------------------- InstructionView.h ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -16,8 +16,8 @@ #define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONVIEW_H #include "Views/View.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/JSON.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { namespace mca { @@ -34,15 +34,12 @@ public: void printView(llvm::raw_ostream &) const override {} InstructionView(const llvm::MCSubtargetInfo &STI, - llvm::MCInstPrinter &Printer, - llvm::ArrayRef S) + llvm::MCInstPrinter &Printer, llvm::ArrayRef S) : STI(STI), MCIP(Printer), Source(S), InstrStream(InstructionString) {} virtual ~InstructionView(); - StringRef getNameAsString() const override { - return "Instructions"; - } + StringRef getNameAsString() const override { return "Instructions"; } // Return a reference to a string representing a given machine instruction. // The result should be used or copied before the next call to diff --git a/llvm/tools/llvm-mca/Views/InstructionView.cpp b/llvm/tools/llvm-mca/Views/InstructionView.cpp --- a/llvm/tools/llvm-mca/Views/InstructionView.cpp +++ b/llvm/tools/llvm-mca/Views/InstructionView.cpp @@ -1,4 +1,4 @@ -//===----------------------- View.cpp ---------------------------*- C++ -*-===// +//===----------------------- InstructionView.cpp ----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -21,7 +21,8 @@ InstructionView::~InstructionView() = default; -StringRef InstructionView::printInstructionString(const llvm::MCInst &MCI) const { +StringRef +InstructionView::printInstructionString(const llvm::MCInst &MCI) const { InstructionString = ""; MCIP.printInst(&MCI, 0, "", STI, InstrStream); InstrStream.flush(); diff --git a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp --- a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp @@ -65,7 +65,7 @@ for (size_t I = 0, E = Inst.getDefs().size(); I < E; ++I) { const WriteState &WS = Inst.getDefs()[I]; - const ReadState &RS = Inst.getUses()[E - (I+1)]; + const ReadState &RS = Inst.getUses()[E - (I + 1)]; MoveEliminationInfo &Info = MoveElimInfo[Inst.getDefs()[0].getRegisterFileID()]; diff --git a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp --- a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp @@ -71,7 +71,8 @@ } unsigned AvgUsage = (double)SumOfUsedEntries / NumCycles; - double MaxUsagePercentage = ((double)MaxUsedEntries / TotalROBEntries) * 100.0; + double MaxUsagePercentage = + ((double)MaxUsedEntries / TotalROBEntries) * 100.0; double NormalizedMaxPercentage = floor((MaxUsagePercentage * 10) + 0.5) / 10; double AvgUsagePercentage = ((double)AvgUsage / TotalROBEntries) * 100.0; double NormalizedAvgPercentage = floor((AvgUsagePercentage * 10) + 0.5) / 10; diff --git a/llvm/tools/llvm-mca/Views/SummaryView.h b/llvm/tools/llvm-mca/Views/SummaryView.h --- a/llvm/tools/llvm-mca/Views/SummaryView.h +++ b/llvm/tools/llvm-mca/Views/SummaryView.h @@ -1,4 +1,4 @@ -//===--------------------- SummaryView.h ---------------------*- C++ -*-===// +//===--------------------- SummaryView.h ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/llvm/tools/llvm-mca/Views/SummaryView.cpp b/llvm/tools/llvm-mca/Views/SummaryView.cpp --- a/llvm/tools/llvm-mca/Views/SummaryView.cpp +++ b/llvm/tools/llvm-mca/Views/SummaryView.cpp @@ -1,4 +1,4 @@ -//===--------------------- SummaryView.cpp -------------------*- C++ -*-===// +//===--------------------- SummaryView.cpp ----------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -24,9 +24,8 @@ SummaryView::SummaryView(const MCSchedModel &Model, ArrayRef S, unsigned Width) - : SM(Model), Source(S), DispatchWidth(Width?Width: Model.IssueWidth), - LastInstructionIdx(0), - TotalCycles(0), NumMicroOps(0), + : SM(Model), Source(S), DispatchWidth(Width ? Width : Model.IssueWidth), + LastInstructionIdx(0), TotalCycles(0), NumMicroOps(0), ProcResourceUsage(Model.getNumProcResourceKinds(), 0), ProcResourceMasks(Model.getNumProcResourceKinds()), ResIdx2ProcResID(Model.getNumProcResourceKinds(), 0) { diff --git a/llvm/tools/llvm-mca/Views/TimelineView.h b/llvm/tools/llvm-mca/Views/TimelineView.h --- a/llvm/tools/llvm-mca/Views/TimelineView.h +++ b/llvm/tools/llvm-mca/Views/TimelineView.h @@ -125,7 +125,7 @@ unsigned LastCycle; struct TimelineViewEntry { - int CycleDispatched; // A negative value is an "invalid cycle". + int CycleDispatched; // A negative value is an "invalid cycle". unsigned CycleReady; unsigned CycleIssued; unsigned CycleExecuted; diff --git a/llvm/tools/llvm-mca/Views/View.h b/llvm/tools/llvm-mca/Views/View.h --- a/llvm/tools/llvm-mca/Views/View.h +++ b/llvm/tools/llvm-mca/Views/View.h @@ -17,8 +17,8 @@ #include "llvm/MC/MCInstPrinter.h" #include "llvm/MCA/HWEventListener.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/JSON.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { namespace mca { diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp --- a/llvm/tools/llvm-mca/llvm-mca.cpp +++ b/llvm/tools/llvm-mca/llvm-mca.cpp @@ -95,15 +95,13 @@ cl::desc("Target a specific cpu type (-mcpu=help for details)"), cl::value_desc("cpu-name"), cl::cat(ToolOptions), cl::init("native")); -static cl::opt - MATTR("mattr", - cl::desc("Additional target features."), - cl::cat(ToolOptions)); +static cl::opt MATTR("mattr", + cl::desc("Additional target features."), + cl::cat(ToolOptions)); -static cl::opt - PrintJson("json", - cl::desc("Print the output in json format"), - cl::cat(ToolOptions), cl::init(false)); +static cl::opt PrintJson("json", + cl::desc("Print the output in json format"), + cl::cat(ToolOptions), cl::init(false)); static cl::opt OutputAsmVariant("output-asm-variant", @@ -573,8 +571,8 @@ mca::PipelinePrinter Printer(*P, *Region, RegionIdx, *STI); if (PrintJson) { - auto IV = std::make_unique(*STI, *IP, Insts); - Printer.addView(std::move(IV)); + Printer.addView( + std::make_unique(*STI, *IP, Insts)); } // Create the views for this pipeline, execute, and emit a report.