[PATCH] D57657: [llvm-exegesis] Cut run time of analysis mode by -84% (*sic*) (YamlContext::getInstrOpcode())

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 4 00:31:32 PST 2019


courbet accepted this revision.
courbet added a comment.
This revision is now accepted and ready to land.

Thanks !



================
Comment at: tools/llvm-exegesis/lib/BenchmarkResult.cpp:36
+
+  llvm::StringMap<unsigned> generateOpcodeNameToOpcodeIdxMapping() {
+    const llvm::MCInstrInfo &InstrInfo = State->getInstrInfo();
----------------
please make this `const`, or  `static` + pass `InstrInfo` as a parameter (slight preference for the latter).


================
Comment at: tools/llvm-exegesis/lib/BenchmarkResult.cpp:40
+    for (unsigned I = 0, E = InstrInfo.getNumOpcodes(); I < E; ++I)
+      Map.insert(std::make_pair(InstrInfo.getName(I), I));
+    assert(Map.size() == InstrInfo.getNumOpcodes() && "Size prediction failed");
----------------
[nit] Since you're not using the return value, consider using the shorter `Map[InstrInfo.getName(I)] = I`.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57657





More information about the llvm-commits mailing list