diff --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp --- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp +++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp @@ -613,7 +613,7 @@ // Stores `VolatileStr` into a cache and returns a StringRef of the cached // version. StringRef getInternalizedString(std::string VolatileStr) { - static llvm::StringSet<> StringCache; + static llvm::StringSet StringCache; return StringCache.insert(std::move(VolatileStr)).first->getKey(); } diff --git a/libc/benchmarks/automemcpy/lib/ResultAnalyzerMain.cpp b/libc/benchmarks/automemcpy/lib/ResultAnalyzerMain.cpp --- a/libc/benchmarks/automemcpy/lib/ResultAnalyzerMain.cpp +++ b/libc/benchmarks/automemcpy/lib/ResultAnalyzerMain.cpp @@ -20,6 +20,12 @@ static cl::list InputFilenames(cl::Positional, cl::OneOrMore, cl::desc("")); +// User can filter the distributions to be taken into account. +static cl::list + KeepOnlyDistributions("keep-only-distributions", cl::ZeroOrMore, + cl::desc("")); + namespace automemcpy { // This is defined in the autogenerated 'Implementations.cpp' file. @@ -48,7 +54,7 @@ // Functions and distributions names are stored quite a few times so it's more // efficient to internalize these strings and refer to them through 'StringRef'. static StringRef getInternalizedString(StringRef VolatileStr) { - static llvm::StringSet<> StringCache; + static llvm::StringSet StringCache; return StringCache.insert(VolatileStr).first->getKey(); } @@ -121,6 +127,15 @@ llvm::append_range(Samples, Result.Samples); } + if (!KeepOnlyDistributions.empty()) { + llvm::StringSet ValidDistributions; + ValidDistributions.insert(KeepOnlyDistributions.begin(), + KeepOnlyDistributions.end()); + llvm::erase_if(Samples, [&ValidDistributions](const Sample &S) { + return !ValidDistributions.contains(S.Id.Distribution.Name); + }); + } + // Extracts median of throughputs. std::vector Functions = getThroughputs(Samples); fillScores(Functions);