diff options
| author | Matt Davis <Matthew.Davis@sony.com> | 2018-12-19 18:27:05 +0000 | 
|---|---|---|
| committer | Matt Davis <Matthew.Davis@sony.com> | 2018-12-19 18:27:05 +0000 | 
| commit | 4b7396e25f7354c0abf2fc59c3b30b59c38a3c25 (patch) | |
| tree | 2047b821c6762c336952758805417ce2cf6ccde9 /llvm/tools/llvm-mca | |
| parent | da9c5dba961d8f110022400ef81faf0f4bc93ffc (diff) | |
| download | bcm5719-llvm-4b7396e25f7354c0abf2fc59c3b30b59c38a3c25.tar.gz bcm5719-llvm-4b7396e25f7354c0abf2fc59c3b30b59c38a3c25.zip  | |
 [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
llvm-svn: 349659
Diffstat (limited to 'llvm/tools/llvm-mca')
| -rw-r--r-- | llvm/tools/llvm-mca/llvm-mca.cpp | 24 | 
1 files changed, 14 insertions, 10 deletions
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp index d0da3b85c28..37c997c4176 100644 --- a/llvm/tools/llvm-mca/llvm-mca.cpp +++ b/llvm/tools/llvm-mca/llvm-mca.cpp @@ -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> 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> 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;  | 

