[llvm-mca] Return the total number of cycles from method Pipeline::run().
If a user only cares about the overall latency, then the best/quickest way is to
change method Pipeline::run() so that it returns the total number of cycles to
the caller.
When the simulation pipeline is run, the number of cycles (or an error) is
returned from method Pipeline::run().
The advantage is that no hardware event listener is needed for computing that
latency. So, the whole process should be faster (and simpler - at least for that
particular use case).
llvm-svn: 347767
diff --git a/llvm/tools/llvm-mca/lib/Pipeline.cpp b/llvm/tools/llvm-mca/lib/Pipeline.cpp
index 309f415..0f91060 100644
--- a/llvm/tools/llvm-mca/lib/Pipeline.cpp
+++ b/llvm/tools/llvm-mca/lib/Pipeline.cpp
@@ -35,7 +35,7 @@
});
}
-Error Pipeline::run() {
+Expected<unsigned> Pipeline::run() {
assert(!Stages.empty() && "Unexpected empty pipeline found!");
do {
@@ -46,7 +46,7 @@
++Cycles;
} while (hasWorkToProcess());
- return ErrorSuccess();
+ return Cycles;
}
Error Pipeline::runCycle() {