[PATCH] D47013: [llvm-exegesis] Write out inconsistencies to a file.

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 17 06:11:51 PDT 2018


gchatelet requested changes to this revision.
gchatelet added inline comments.
This revision now requires changes to proceed.


================
Comment at: tools/llvm-exegesis/llvm-exegesis.cpp:178
 
-  std::error_code ErrorCode;
-  llvm::raw_fd_ostream ClustersOS(AnalysisClustersFile, ErrorCode,
-                                  llvm::sys::fs::F_RW);
-  if (ErrorCode)
-    llvm::report_fatal_error("cannot open out file: " + AnalysisClustersFile);
-
-  if (auto Err = Analyzer.printClusters(ClustersOS))
-    llvm::report_fatal_error(std::move(Err));
-
-  if (auto Err = Analyzer.printSchedClassInconsistencies(llvm::outs()))
-    llvm::report_fatal_error(std::move(Err));
+  maybePrintAnalysis(Analyzer, "analysis clusters", AnalysisClustersFile,
+                     &Analysis::printClusters);
----------------
Since there's no performance issue here, I'd rather separate the report generation from saving it:
```
std::string ClusterReport;
if (auto Err = Analyzer.printClusters(llvm::raw_string_ostream(ClusterReport))) {
  PrintAnalysis("analysis clusters", AnalysisClustersFile, ClusterReport );
}

std::string InconsistenciesReport;
if (auto Err = Analyzer.printClusters(llvm::raw_string_ostream(InconsistenciesReport))) {
  PrintAnalysis("sched class consistency analysis", AnalysisInconsistenciesFile, InconsistenciesReport );
}

```


Repository:
  rL LLVM

https://reviews.llvm.org/D47013





More information about the llvm-commits mailing list