[PATCH] D86390: [llvm-mca][NFC] Refactor instruction printing

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 01:38:11 PDT 2020


andreadb added inline comments.


================
Comment at: llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp:311
   const DependencyEdge &FirstEdge = *Seq[0];
+  const ArrayRef<llvm::MCInst> Source = getSource();
   unsigned FromIID = FirstEdge.FromIID % Source.size();
----------------
Remove `const`.


================
Comment at: llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp:504
 
+  const ArrayRef<llvm::MCInst> Source = getSource();
   const Instruction &IS = *Event.IR.getInstruction();
----------------
Remove `const`.


================
Comment at: llvm/tools/llvm-mca/Views/InstructionInfoView.cpp:24
 
+  const ArrayRef<llvm::MCInst> &Source = getSource();
   if (!Source.size())
----------------
Remove `const`.


================
Comment at: llvm/tools/llvm-mca/Views/ResourcePressureView.cpp:55
   const auto &IssueEvent = static_cast<const HWInstructionIssuedEvent &>(Event);
+  const ArrayRef<llvm::MCInst> &Source = getSource();
   const unsigned SourceIdx = Event.IR.getSourceIndex() % Source.size();
----------------
Remove `const`.


================
Comment at: llvm/tools/llvm-mca/Views/ResourcePressureView.cpp:136
 
+  const ArrayRef<llvm::MCInst> Source = getSource();
   const unsigned Executions = LastInstructionIdx / Source.size() + 1;
----------------
Remove `const`.


================
Comment at: llvm/tools/llvm-mca/Views/ResourcePressureView.cpp:157
   unsigned InstrIndex = 0;
+  const ArrayRef<llvm::MCInst> Source = getSource();
   const unsigned Executions = LastInstructionIdx / Source.size() + 1;
----------------
Remove `const`


================
Comment at: llvm/tools/llvm-mca/Views/TimelineView.cpp:283
   unsigned IID = 0;
+  const ArrayRef<llvm::MCInst> &Source = getSource();
   const unsigned Iterations = Timeline.size() / Source.size();
----------------
Remove `const`.


================
Comment at: llvm/tools/llvm-mca/Views/View.h:36
+  llvm::MCInstPrinter &MCIP;
+  const llvm::ArrayRef<llvm::MCInst> Source;
+
----------------
Don't need `const`. It is not a mutable array.


================
Comment at: llvm/tools/llvm-mca/Views/View.h:45
+                  llvm::MCInstPrinter &Printer,
+                  const llvm::ArrayRef<llvm::MCInst> S)
+      : STI(STI), MCIP(Printer), Source(S), InstrStream(InstructionString) {}
----------------
Remove `const`.


================
Comment at: llvm/tools/llvm-mca/Views/View.h:61
+  llvm::MCInstPrinter &getInstPrinter() const { return MCIP; }
+  const llvm::ArrayRef<llvm::MCInst> getSource() const { return Source; }
+};
----------------
Don't need `const` for this. ArrayRef is already a constant reference.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86390/new/

https://reviews.llvm.org/D86390



More information about the llvm-commits mailing list