[llvm] r349659 - [llvm-mca] Add an error handler for error from parseCodeRegions
Matt Davis via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 19 10:27:05 PST 2018
Author: mattd
Date: Wed Dec 19 10:27:05 2018
New Revision: 349659
URL: http://llvm.org/viewvc/llvm-project?rev=349659&view=rev
Log:
[llvm-mca] Add an error handler for error from parseCodeRegions
Summary:
It's a bit tricky to add a test for the failing path right now, binary support will have an easier path to exercise the path here.
* Ran clang-format.
Reviewers: andreadb
Reviewed By: andreadb
Subscribers: tschuett, gbedwell, llvm-commits
Differential Revision: https://reviews.llvm.org/D55803
Modified:
llvm/trunk/tools/llvm-mca/llvm-mca.cpp
Modified: llvm/trunk/tools/llvm-mca/llvm-mca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/llvm-mca.cpp?rev=349659&r1=349658&r2=349659&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/llvm-mca.cpp (original)
+++ llvm/trunk/tools/llvm-mca/llvm-mca.cpp Wed Dec 19 10:27:05 2018
@@ -149,15 +149,13 @@ static cl::opt<bool>
cl::desc("If set, assume that loads and stores do not alias"),
cl::cat(ToolOptions), cl::init(true));
-static cl::opt<unsigned>
- LoadQueueSize("lqueue",
- cl::desc("Size of the load queue"),
- cl::cat(ToolOptions), cl::init(0));
-
-static cl::opt<unsigned>
- StoreQueueSize("squeue",
- cl::desc("Size of the store queue"),
- cl::cat(ToolOptions), cl::init(0));
+static cl::opt<unsigned> LoadQueueSize("lqueue",
+ cl::desc("Size of the load queue"),
+ cl::cat(ToolOptions), cl::init(0));
+
+static cl::opt<unsigned> StoreQueueSize("squeue",
+ cl::desc("Size of the store queue"),
+ cl::cat(ToolOptions), cl::init(0));
static cl::opt<bool>
PrintInstructionTables("instruction-tables",
@@ -339,8 +337,14 @@ int main(int argc, char **argv) {
// Parse the input and create CodeRegions that llvm-mca can analyze.
mca::AsmCodeRegionGenerator CRG(*TheTarget, SrcMgr, Ctx, *MAI, *STI, *MCII);
Expected<const mca::CodeRegions &> RegionsOrErr = CRG.parseCodeRegions();
- if (auto Err = RegionsOrErr.takeError()) {
- WithColor::error() << Err << "\n";
+ if (!RegionsOrErr) {
+ if (auto Err =
+ handleErrors(RegionsOrErr.takeError(), [](const StringError &Err) {
+ WithColor::error() << Err.getMessage() << '\n';
+ })) {
+ // Default case.
+ WithColor::error() << toString(std::move(Err)) << '\n';
+ }
return 1;
}
const mca::CodeRegions &Regions = *RegionsOrErr;
More information about the llvm-commits
mailing list