aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-mca/llvm-mca.cpp
diff options
context:
space:
mode:
authorMichael Maitland <michaeltmaitland@gmail.com>2023-05-12 09:56:43 -0700
committerMichael Maitland <michaeltmaitland@gmail.com>2023-05-22 16:41:19 -0700
commitc1fe1474d27f6fe7b8e5bfedcc9066e9a90ad85e (patch)
treebf3b3013d86d775cbab98ba190ab5d3e07c42bcc /llvm/tools/llvm-mca/llvm-mca.cpp
parentabba5de724665362db707d4cfab598cfbf5a475e (diff)
downloadllvm-c1fe1474d27f6fe7b8e5bfedcc9066e9a90ad85e.zip
llvm-c1fe1474d27f6fe7b8e5bfedcc9066e9a90ad85e.tar.gz
llvm-c1fe1474d27f6fe7b8e5bfedcc9066e9a90ad85e.tar.bz2
[llvm-mca] Print InstructionInfoView using Instrument information.
Previous reports calculated the overall report using Instrument information but did not print out per-instruction data using Instrument information. This patch fixes that. Differential Revision: https://reviews.llvm.org/D150459
Diffstat (limited to 'llvm/tools/llvm-mca/llvm-mca.cpp')
-rw-r--r--llvm/tools/llvm-mca/llvm-mca.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index 23b537e..eb71cff 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -571,11 +571,14 @@ int main(int argc, char **argv) {
IPP->resetState();
+ DenseMap<const MCInst *, SmallVector<mca::Instrument *>>
+ InstToInstruments;
SmallVector<std::unique_ptr<mca::Instruction>> LoweredSequence;
for (const MCInst &MCI : Insts) {
SMLoc Loc = MCI.getLoc();
const SmallVector<mca::Instrument *> Instruments =
InstrumentRegions.getActiveInstruments(Loc);
+ InstToInstruments.insert({&MCI, Instruments});
Expected<std::unique_ptr<mca::Instruction>> Inst =
IB.createInstruction(MCI, Instruments);
@@ -621,7 +624,7 @@ int main(int argc, char **argv) {
if (PrintInstructionInfoView) {
Printer.addView(std::make_unique<mca::InstructionInfoView>(
*STI, *MCII, CE, ShowEncoding, Insts, *IP, LoweredSequence,
- ShowBarriers));
+ ShowBarriers, *IM, InstToInstruments));
}
Printer.addView(
std::make_unique<mca::ResourcePressureView>(*STI, *IP, Insts));
@@ -698,7 +701,7 @@ int main(int argc, char **argv) {
if (PrintInstructionInfoView)
Printer.addView(std::make_unique<mca::InstructionInfoView>(
*STI, *MCII, CE, ShowEncoding, Insts, *IP, LoweredSequence,
- ShowBarriers));
+ ShowBarriers, *IM, InstToInstruments));
// Fetch custom Views that are to be placed after the InstructionInfoView.
// Refer to the comment paired with the CB->getStartViews(*IP, Insts); line