From e752fd65e8cbcf960ea9d1287713b5c279fad924 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 18 Jun 2018 11:27:47 +0000 Subject: [llvm-exegesis] Optionally ignore instructions without a sched class. Summary: See PR37602. Reviewers: RKSimon Subscribers: llvm-commits, tschuett Differential Revision: https://reviews.llvm.org/D48267 llvm-svn: 334932 --- llvm/tools/llvm-exegesis/llvm-exegesis.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'llvm/tools/llvm-exegesis/llvm-exegesis.cpp') diff --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp index 09e9693a96a..7e2caf3198e 100644 --- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp +++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp @@ -60,6 +60,11 @@ static llvm::cl::opt llvm::cl::desc("number of time to repeat the asm snippet"), llvm::cl::init(10000)); +static llvm::cl::opt IgnoreInvalidSchedClass( + "ignore-invalid-sched-class", + llvm::cl::desc("ignore instructions that do not define a sched class"), + llvm::cl::init(false)); + static llvm::cl::opt AnalysisNumPoints( "analysis-numpoints", llvm::cl::desc("minimum number of points in an analysis cluster"), @@ -120,6 +125,15 @@ void benchmarkMain() { X86Filter Filter; const LLVMState State; + const auto Opcode = GetOpcodeOrDie(State.getInstrInfo()); + + // Ignore instructions without a sched class if -ignore-invalid-sched-class is + // passed. + if (IgnoreInvalidSchedClass && + State.getInstrInfo().get(Opcode).getSchedClass() == 0) { + llvm::errs() << "ignoring instruction without sched class\n"; + return; + } // FIXME: Do not require SchedModel for latency. if (!State.getSubtargetInfo().getSchedModel().hasExtraProcessorInfo()) @@ -145,8 +159,8 @@ void benchmarkMain() { BenchmarkFile = "-"; const BenchmarkResultContext Context = getBenchmarkResultContext(State); - std::vector Results = ExitOnErr(Runner->run( - GetOpcodeOrDie(State.getInstrInfo()), Filter, NumRepetitions)); + std::vector Results = + ExitOnErr(Runner->run(Opcode, Filter, NumRepetitions)); for (InstructionBenchmark &Result : Results) ExitOnErr(Result.writeYaml(Context, BenchmarkFile)); -- cgit v1.2.3