[llvm] r334932 - [llvm-exegesis] Optionally ignore instructions without a sched class.
Clement Courbet via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 18 04:27:48 PDT 2018
Author: courbet
Date: Mon Jun 18 04:27:47 2018
New Revision: 334932
URL: http://llvm.org/viewvc/llvm-project?rev=334932&view=rev
Log:
[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
Modified:
llvm/trunk/docs/CommandGuide/llvm-exegesis.rst
llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp
Modified: llvm/trunk/docs/CommandGuide/llvm-exegesis.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-exegesis.rst?rev=334932&r1=334931&r2=334932&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-exegesis.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-exegesis.rst Mon Jun 18 04:27:47 2018
@@ -174,6 +174,10 @@ OPTIONS
Specify the numPoints parameters to be used for DBSCAN clustering
(`analysis` mode).
+ .. option:: -ignore-invalid-sched-class=false
+
+ If set, ignore instructions that do not have a sched class (class idx = 0).
+
EXIT STATUS
-----------
Modified: llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp?rev=334932&r1=334931&r2=334932&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp Mon Jun 18 04:27:47 2018
@@ -60,6 +60,11 @@ static llvm::cl::opt<unsigned>
llvm::cl::desc("number of time to repeat the asm snippet"),
llvm::cl::init(10000));
+static llvm::cl::opt<bool> 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<unsigned> 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<InstructionBenchmark> Results = ExitOnErr(Runner->run(
- GetOpcodeOrDie(State.getInstrInfo()), Filter, NumRepetitions));
+ std::vector<InstructionBenchmark> Results =
+ ExitOnErr(Runner->run(Opcode, Filter, NumRepetitions));
for (InstructionBenchmark &Result : Results)
ExitOnErr(Result.writeYaml(Context, BenchmarkFile));
More information about the llvm-commits
mailing list