diff options
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/Analysis.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/Analysis.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.cpp b/llvm/tools/llvm-exegesis/lib/Analysis.cpp index 158fbfe3..ba5620e 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.cpp +++ b/llvm/tools/llvm-exegesis/lib/Analysis.cpp @@ -149,7 +149,7 @@ void Analysis::printInstructionRowCsv(const size_t PointId, writeEscaped<kEscapeCsv>(OS, Point.Key.Config); OS << kCsvSep; assert(!Point.Key.Instructions.empty()); - const llvm::MCInst &MCI = Point.Key.Instructions[0]; + const llvm::MCInst &MCI = Point.keyInstruction(); const unsigned SchedClassId = resolveSchedClassId( *SubtargetInfo_, InstrInfo_->get(MCI.getOpcode()).getSchedClass(), MCI); @@ -168,13 +168,15 @@ void Analysis::printInstructionRowCsv(const size_t PointId, } Analysis::Analysis(const llvm::Target &Target, - const InstructionBenchmarkClustering &Clustering) - : Clustering_(Clustering) { + std::unique_ptr<llvm::MCInstrInfo> InstrInfo, + const InstructionBenchmarkClustering &Clustering, + bool AnalysisDisplayUnstableOpcodes) + : Clustering_(Clustering), InstrInfo_(std::move(InstrInfo)), + AnalysisDisplayUnstableOpcodes_(AnalysisDisplayUnstableOpcodes) { if (Clustering.getPoints().empty()) return; const InstructionBenchmark &FirstPoint = Clustering.getPoints().front(); - InstrInfo_.reset(Target.createMCInstrInfo()); RegInfo_.reset(Target.createMCRegInfo(FirstPoint.LLVMTriple)); AsmInfo_.reset(Target.createMCAsmInfo(*RegInfo_, FirstPoint.LLVMTriple)); SubtargetInfo_.reset(Target.createMCSubtargetInfo(FirstPoint.LLVMTriple, @@ -233,7 +235,7 @@ Analysis::makePointsPerSchedClass() const { assert(!Point.Key.Instructions.empty()); // FIXME: we should be using the tuple of classes for instructions in the // snippet as key. - const llvm::MCInst &MCI = Point.Key.Instructions[0]; + const llvm::MCInst &MCI = Point.keyInstruction(); unsigned SchedClassId = InstrInfo_->get(MCI.getOpcode()).getSchedClass(); const bool WasVariant = SchedClassId && SubtargetInfo_->getSchedModel() .getSchedClassDesc(SchedClassId) @@ -668,6 +670,8 @@ llvm::Error Analysis::run<Analysis::PrintSchedClassInconsistencies>( const auto &ClusterId = Clustering_.getClusterIdForPoint(PointId); if (!ClusterId.isValid()) continue; // Ignore noise and errors. FIXME: take noise into account ? + if (ClusterId.isUnstable() ^ AnalysisDisplayUnstableOpcodes_) + continue; // Either display stable or unstable clusters only. auto SchedClassClusterIt = std::find_if(SchedClassClusters.begin(), SchedClassClusters.end(), [ClusterId](const SchedClassCluster &C) { |