[llvm] 9810fe1 - [MCSchedule] Simplify and remove a C++20-deprecated is_pod call. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 8 15:09:27 PST 2023
Author: Fangrui Song
Date: 2023-12-08T15:09:22-08:00
New Revision: 9810fe1a91eb9ce18246fb1528232a539dbd37fc
URL: https://github.com/llvm/llvm-project/commit/9810fe1a91eb9ce18246fb1528232a539dbd37fc
DIFF: https://github.com/llvm/llvm-project/commit/9810fe1a91eb9ce18246fb1528232a539dbd37fc.diff
LOG: [MCSchedule] Simplify and remove a C++20-deprecated is_pod call. NFC
Added:
Modified:
llvm/include/llvm/CodeGen/TargetSchedule.h
llvm/include/llvm/MC/MCInstrItineraries.h
llvm/include/llvm/MC/MCSchedule.h
llvm/lib/MC/MCSchedule.cpp
llvm/lib/MC/MCSubtargetInfo.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/TargetSchedule.h b/llvm/include/llvm/CodeGen/TargetSchedule.h
index 3d39798790cdc..bfe4234abf8eb 100644
--- a/llvm/include/llvm/CodeGen/TargetSchedule.h
+++ b/llvm/include/llvm/CodeGen/TargetSchedule.h
@@ -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.
///
diff --git a/llvm/include/llvm/MC/MCInstrItineraries.h b/llvm/include/llvm/MC/MCInstrItineraries.h
index d1c2e788ee810..6b29686d8c4f1 100644
--- a/llvm/include/llvm/MC/MCInstrItineraries.h
+++ b/llvm/include/llvm/MC/MCInstrItineraries.h
@@ -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 =
diff --git a/llvm/include/llvm/MC/MCSchedule.h b/llvm/include/llvm/MC/MCSchedule.h
index 98ebe42cfd133..5a6471ac1c892 100644
--- a/llvm/include/llvm/MC/MCSchedule.h
+++ b/llvm/include/llvm/MC/MCSchedule.h
@@ -390,7 +390,6 @@ struct MCSchedModel {
unsigned WriteResourceIdx = 0);
/// Returns the default initialized model.
- static const MCSchedModel &GetDefaultSchedModel() { return Default; }
static const MCSchedModel Default;
};
diff --git a/llvm/lib/MC/MCSchedule.cpp b/llvm/lib/MC/MCSchedule.cpp
index 990a693559a77..4f7125864c5a0 100644
--- a/llvm/lib/MC/MCSchedule.cpp
+++ b/llvm/lib/MC/MCSchedule.cpp
@@ -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,
@@ -30,7 +30,7 @@ const MCSchedModel MCSchedModel::Default = {DefaultIssueWidth,
DefaultMispredictPenalty,
false,
true,
- false /*EnableIntervals*/,
+ /*EnableIntervals=*/false,
0,
nullptr,
nullptr,
diff --git a/llvm/lib/MC/MCSubtargetInfo.cpp b/llvm/lib/MC/MCSubtargetInfo.cpp
index 8ee823e0377b7..cf3aba17fc3d4 100644
--- a/llvm/lib/MC/MCSubtargetInfo.cpp
+++ b/llvm/lib/MC/MCSubtargetInfo.cpp
@@ -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,
@@ -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;
More information about the llvm-commits
mailing list