summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-07-02 20:39:57 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-07-02 20:39:57 +0000
commit9b3cb081f3a558dad5c1d24c5d5bd03a34c8ac38 (patch)
treef6f11396ed658689752c5845b29975df03b4456a /llvm/tools/llvm-mca
parent7aea360924bae0559d50774c88d60381247bd7eb (diff)
downloadbcm5719-llvm-9b3cb081f3a558dad5c1d24c5d5bd03a34c8ac38.tar.gz
bcm5719-llvm-9b3cb081f3a558dad5c1d24c5d5bd03a34c8ac38.zip
[llvm-mca] Clear the content of map VariantDescriptors in InstrBuilder before we start analyzing a new CodeBlock. NFCI.
Different CodeBlocks don't overlap. The same MCInst cannot appear in more than one code block because all blocks are instantiated before the simulation is run. We should always clear the content of map VariantDescriptors before every simulation, since VariantDescriptors cannot possibly store useful information for the next blocks. It is also "safer" to clear its content because `MCInst*` is used as the key type for map VariantDescriptors. llvm-svn: 336142
Diffstat (limited to 'llvm/tools/llvm-mca')
-rw-r--r--llvm/tools/llvm-mca/InstrBuilder.h2
-rw-r--r--llvm/tools/llvm-mca/llvm-mca.cpp3
2 files changed, 5 insertions, 0 deletions
diff --git a/llvm/tools/llvm-mca/InstrBuilder.h b/llvm/tools/llvm-mca/InstrBuilder.h
index 1c325d911e3..e5e80d7cf79 100644
--- a/llvm/tools/llvm-mca/InstrBuilder.h
+++ b/llvm/tools/llvm-mca/InstrBuilder.h
@@ -69,6 +69,8 @@ public:
return ProcResourceMasks;
}
+ void clear() { VariantDescriptors.shrink_and_clear(); }
+
std::unique_ptr<Instruction> createInstruction(const llvm::MCInst &MCI);
};
} // namespace mca
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index 4cdd6baba5e..6bea82741db 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -547,6 +547,9 @@ int main(int argc, char **argv) {
P->run();
Printer.printReport(TOF->os());
+
+ // Clear the InstrBuilder internal state in preparation for another round.
+ IB.clear();
}
TOF->keep();
OpenPOWER on IntegriCloud