Index: tools/llvm-mca/include/Pipeline.h =================================================================== --- tools/llvm-mca/include/Pipeline.h +++ tools/llvm-mca/include/Pipeline.h @@ -67,7 +67,10 @@ public: Pipeline() : Cycles(0) {} void appendStage(std::unique_ptr S); - Error run(); + + // Returns the total number of simulated cycles. + Expected run(); + void addEventListener(HWEventListener *Listener); }; } // namespace mca Index: tools/llvm-mca/lib/Pipeline.cpp =================================================================== --- tools/llvm-mca/lib/Pipeline.cpp +++ tools/llvm-mca/lib/Pipeline.cpp @@ -35,7 +35,7 @@ }); } -Error Pipeline::run() { +Expected Pipeline::run() { assert(!Stages.empty() && "Unexpected empty pipeline found!"); do { @@ -46,7 +46,7 @@ ++Cycles; } while (hasWorkToProcess()); - return ErrorSuccess(); + return Cycles; } Error Pipeline::runCycle() { Index: tools/llvm-mca/llvm-mca.cpp =================================================================== --- tools/llvm-mca/llvm-mca.cpp +++ tools/llvm-mca/llvm-mca.cpp @@ -240,8 +240,9 @@ // Returns true on success. static bool runPipeline(mca::Pipeline &P) { // Handle pipeline errors here. - if (auto Err = P.run()) { - WithColor::error() << toString(std::move(Err)); + Expected Cycles = P.run(); + if (!Cycles) { + WithColor::error() << toString(Cycles.takeError()); return false; } return true;