Skip to content

Commit

Permalink
[MCSchedule] Simplify and remove a C++20-deprecated is_pod call. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Dec 8, 2023
1 parent 44dc1e0 commit 9810fe1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/TargetSchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TargetSchedModel {
unsigned computeInstrLatency(const MCSchedClassDesc &SCDesc) const;

public:
TargetSchedModel() : SchedModel(MCSchedModel::GetDefaultSchedModel()) {}
TargetSchedModel() : SchedModel(MCSchedModel::Default) {}

/// Initialize the machine model for instruction scheduling.
///
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/MC/MCInstrItineraries.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ struct InstrItinerary {
class InstrItineraryData {
public:
MCSchedModel SchedModel =
MCSchedModel::GetDefaultSchedModel(); ///< Basic machine properties.
const InstrStage *Stages = nullptr; ///< Array of stages selected
MCSchedModel::Default; ///< Basic machine properties.
const InstrStage *Stages = nullptr; ///< Array of stages selected
const unsigned *OperandCycles = nullptr; ///< Array of operand cycles selected
const unsigned *Forwardings = nullptr; ///< Array of pipeline forwarding paths
const InstrItinerary *Itineraries =
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/MC/MCSchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ struct MCSchedModel {
unsigned WriteResourceIdx = 0);

/// Returns the default initialized model.
static const MCSchedModel &GetDefaultSchedModel() { return Default; }
static const MCSchedModel Default;
};

Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/MC/MCSchedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

using namespace llvm;

static_assert(std::is_pod<MCSchedModel>::value,
"We shouldn't have a static constructor here");
static_assert(std::is_trivial_v<MCSchedModel>,
"MCSchedModel is required to be a trivial type");
const MCSchedModel MCSchedModel::Default = {DefaultIssueWidth,
DefaultMicroOpBufferSize,
DefaultLoopMicroOpBufferSize,
Expand All @@ -30,7 +30,7 @@ const MCSchedModel MCSchedModel::Default = {DefaultIssueWidth,
DefaultMispredictPenalty,
false,
true,
false /*EnableIntervals*/,
/*EnableIntervals=*/false,
0,
nullptr,
nullptr,
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/MC/MCSubtargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void MCSubtargetInfo::InitMCProcessorInfo(StringRef CPU, StringRef TuneCPU,
if (!TuneCPU.empty())
CPUSchedModel = &getSchedModelForCPU(TuneCPU);
else
CPUSchedModel = &MCSchedModel::GetDefaultSchedModel();
CPUSchedModel = &MCSchedModel::Default;
}

void MCSubtargetInfo::setDefaultFeatures(StringRef CPU, StringRef TuneCPU,
Expand Down Expand Up @@ -319,7 +319,7 @@ const MCSchedModel &MCSubtargetInfo::getSchedModelForCPU(StringRef CPU) const {
errs() << "'" << CPU
<< "' is not a recognized processor for this target"
<< " (ignoring processor)\n";
return MCSchedModel::GetDefaultSchedModel();
return MCSchedModel::Default;
}
assert(CPUEntry->SchedModel && "Missing processor SchedModel value");
return *CPUEntry->SchedModel;
Expand Down

0 comments on commit 9810fe1

Please sign in to comment.