[PATCH] D48267: [llvm-exegesis] Optionally ignore instructions without a sched class.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 00:07:26 PDT 2018


courbet created this revision.
courbet added a reviewer: RKSimon.
Herald added a subscriber: tschuett.

See PR37602.


Repository:
  rL LLVM

https://reviews.llvm.org/D48267

Files:
  docs/CommandGuide/llvm-exegesis.rst
  tools/llvm-exegesis/llvm-exegesis.cpp


Index: tools/llvm-exegesis/llvm-exegesis.cpp
===================================================================
--- tools/llvm-exegesis/llvm-exegesis.cpp
+++ tools/llvm-exegesis/llvm-exegesis.cpp
@@ -60,6 +60,11 @@
                    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 @@
   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 @@
     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));
 
Index: docs/CommandGuide/llvm-exegesis.rst
===================================================================
--- docs/CommandGuide/llvm-exegesis.rst
+++ docs/CommandGuide/llvm-exegesis.rst
@@ -174,6 +174,10 @@
  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
 -----------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48267.151658.patch
Type: text/x-patch
Size: 2173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180618/69ef4999/attachment.bin>


More information about the llvm-commits mailing list