[PATCH] D100743: [llvm-exegesis] Honor -mcpu in analysis mode.
Clement Courbet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 19 00:45:44 PDT 2021
courbet created this revision.
courbet added a reviewer: gchatelet.
Herald added a subscriber: mstojanovic.
courbet requested review of this revision.
Herald added a project: LLVM.
This is useful to set the baseline model for an unknown CPU.
Fixes PR50013.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100743
Files:
llvm/tools/llvm-exegesis/lib/Analysis.cpp
llvm/tools/llvm-exegesis/lib/Analysis.h
llvm/tools/llvm-exegesis/llvm-exegesis.cpp
Index: llvm/tools/llvm-exegesis/llvm-exegesis.cpp
===================================================================
--- llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -436,7 +436,7 @@
const Analysis Analyzer(*TheTarget, std::move(InstrInfo), Clustering,
AnalysisInconsistencyEpsilon,
- AnalysisDisplayUnstableOpcodes);
+ AnalysisDisplayUnstableOpcodes, CpuName);
maybeRunAnalysis<Analysis::PrintClusters>(Analyzer, "analysis clusters",
AnalysisClustersOutputFile);
Index: llvm/tools/llvm-exegesis/lib/Analysis.h
===================================================================
--- llvm/tools/llvm-exegesis/lib/Analysis.h
+++ llvm/tools/llvm-exegesis/lib/Analysis.h
@@ -39,7 +39,8 @@
Analysis(const Target &Target, std::unique_ptr<MCInstrInfo> InstrInfo,
const InstructionBenchmarkClustering &Clustering,
double AnalysisInconsistencyEpsilon,
- bool AnalysisDisplayUnstableOpcodes);
+ bool AnalysisDisplayUnstableOpcodes,
+ const std::string &ForceCpuName = "");
// Prints a csv of instructions for each cluster.
struct PrintClusters {};
Index: llvm/tools/llvm-exegesis/lib/Analysis.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/Analysis.cpp
+++ llvm/tools/llvm-exegesis/lib/Analysis.cpp
@@ -154,7 +154,8 @@
Analysis::Analysis(const Target &Target, std::unique_ptr<MCInstrInfo> InstrInfo,
const InstructionBenchmarkClustering &Clustering,
double AnalysisInconsistencyEpsilon,
- bool AnalysisDisplayUnstableOpcodes)
+ bool AnalysisDisplayUnstableOpcodes,
+ const std::string &ForceCpuName)
: Clustering_(Clustering), InstrInfo_(std::move(InstrInfo)),
AnalysisInconsistencyEpsilonSquared_(AnalysisInconsistencyEpsilon *
AnalysisInconsistencyEpsilon),
@@ -163,12 +164,14 @@
return;
const InstructionBenchmark &FirstPoint = Clustering.getPoints().front();
+ const std::string CpuName =
+ ForceCpuName.empty() ? FirstPoint.CpuName : ForceCpuName;
RegInfo_.reset(Target.createMCRegInfo(FirstPoint.LLVMTriple));
MCTargetOptions MCOptions;
AsmInfo_.reset(
Target.createMCAsmInfo(*RegInfo_, FirstPoint.LLVMTriple, MCOptions));
- SubtargetInfo_.reset(Target.createMCSubtargetInfo(FirstPoint.LLVMTriple,
- FirstPoint.CpuName, ""));
+ SubtargetInfo_.reset(
+ Target.createMCSubtargetInfo(FirstPoint.LLVMTriple, CpuName, ""));
InstPrinter_.reset(Target.createMCInstPrinter(
Triple(FirstPoint.LLVMTriple), 0 /*default variant*/, *AsmInfo_,
*InstrInfo_, *RegInfo_));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100743.338440.patch
Type: text/x-patch
Size: 2915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210419/b026a1ef/attachment.bin>
More information about the llvm-commits
mailing list