Skip to content

Commit 9c951ab

Browse files
kazutakahirataDebadri Basak
authored andcommitted
[llvm] Remove "const" in the presence of "constexpr" (NFC) (llvm#166109)
"const" is extraneous in the presence of "constexpr" for simple variables and arrays.
1 parent d8769c6 commit 9c951ab

File tree

29 files changed

+60
-60
lines changed

29 files changed

+60
-60
lines changed

llvm/include/llvm/CodeGen/GlobalMergeFunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class GlobalMergeFunc {
5858
/// The suffix used to identify the merged function that parameterizes
5959
/// the constant values. Note that the original function, without this suffix,
6060
/// becomes a thunk supplying contexts to the merged function via parameters.
61-
static constexpr const char MergingInstanceSuffix[] = ".Tgm";
61+
static constexpr char MergingInstanceSuffix[] = ".Tgm";
6262

6363
GlobalMergeFunc(const ModuleSummaryIndex *Index) : Index(Index) {};
6464

llvm/include/llvm/SandboxIR/Context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Context {
5151
// Uses a 64-bit integer so we don't have to worry about the unlikely case
5252
// of overflowing a 32-bit counter.
5353
using ValTy = uint64_t;
54-
static constexpr const ValTy InvalidVal = 0;
54+
static constexpr ValTy InvalidVal = 0;
5555

5656
private:
5757
// Default initialization results in an invalid ID.

llvm/include/llvm/SandboxIR/Instruction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ class SwitchInst : public SingleLLVMInstructionImpl<llvm::SwitchInst> {
18661866
friend class Context; // For accessing the constructor in create*()
18671867

18681868
public:
1869-
static constexpr const unsigned DefaultPseudoIndex =
1869+
static constexpr unsigned DefaultPseudoIndex =
18701870
llvm::SwitchInst::DefaultPseudoIndex;
18711871

18721872
LLVM_ABI static SwitchInst *create(Value *V, BasicBlock *Dest,

llvm/include/llvm/SandboxIR/PassManager.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ class PassManager : public ParentPass {
5959
Passes.push_back(std::move(Pass));
6060
}
6161

62-
static constexpr const char EndToken = '\0';
63-
static constexpr const char BeginArgsToken = '<';
64-
static constexpr const char EndArgsToken = '>';
65-
static constexpr const char PassDelimToken = ',';
62+
static constexpr char EndToken = '\0';
63+
static constexpr char BeginArgsToken = '<';
64+
static constexpr char EndArgsToken = '>';
65+
static constexpr char PassDelimToken = ',';
6666

6767
/// Parses \p Pipeline as a comma-separated sequence of pass names and sets
6868
/// the pass pipeline, using \p CreatePass to instantiate passes by name.

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ void OpenMPIRBuilder::getKernelArgsVector(TargetKernelArgs &KernelArgs,
528528
Value *Version = Builder.getInt32(OMP_KERNEL_ARG_VERSION);
529529
Value *PointerNum = Builder.getInt32(KernelArgs.NumTargetItems);
530530
auto Int32Ty = Type::getInt32Ty(Builder.getContext());
531-
constexpr const size_t MaxDim = 3;
531+
constexpr size_t MaxDim = 3;
532532
Value *ZeroArray = Constant::getNullValue(ArrayType::get(Int32Ty, MaxDim));
533533
Value *Flags = Builder.getInt64(KernelArgs.HasNoWait);
534534

llvm/lib/Support/UnicodeNameToCodepoint.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ constexpr const char *const HangulSyllables[][3] = {
251251

252252
// Unicode 15.0
253253
// 3.12 Conjoining Jamo Behavior Common constants
254-
constexpr const char32_t SBase = 0xAC00;
255-
constexpr const uint32_t LCount = 19;
256-
constexpr const uint32_t VCount = 21;
257-
constexpr const uint32_t TCount = 28;
254+
constexpr char32_t SBase = 0xAC00;
255+
constexpr uint32_t LCount = 19;
256+
constexpr uint32_t VCount = 21;
257+
constexpr uint32_t TCount = 28;
258258

259259
static std::size_t findSyllable(StringRef Name, bool Strict,
260260
char &PreviousInName, int &Pos, int Column) {

llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ struct AAAMDGPUClusterDimsFunction : public AAAMDGPUClusterDims {
15551555

15561556
AMDGPU::ClusterDimsAttr Attr;
15571557

1558-
static constexpr const char AttrName[] = "amdgpu-cluster-dims";
1558+
static constexpr char AttrName[] = "amdgpu-cluster-dims";
15591559
};
15601560

15611561
AAAMDGPUClusterDims &

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6153,7 +6153,7 @@ bool SIInstrInfo::isLegalRegOperand(const MachineInstr &MI, unsigned OpIdx,
61536153
// information.
61546154
if (AMDGPU::isPackedFP32Inst(MI.getOpcode()) && AMDGPU::isGFX12Plus(ST) &&
61556155
MO.isReg() && RI.isSGPRReg(MRI, MO.getReg())) {
6156-
constexpr const AMDGPU::OpName OpNames[] = {
6156+
constexpr AMDGPU::OpName OpNames[] = {
61576157
AMDGPU::OpName::src0, AMDGPU::OpName::src1, AMDGPU::OpName::src2};
61586158

61596159
for (auto [I, OpName] : enumerate(OpNames)) {
@@ -6215,8 +6215,8 @@ bool SIInstrInfo::isLegalVSrcOperand(const MachineRegisterInfo &MRI,
62156215
bool SIInstrInfo::isLegalGFX12PlusPackedMathFP32Operand(
62166216
const MachineRegisterInfo &MRI, const MachineInstr &MI, unsigned SrcN,
62176217
const MachineOperand *MO) const {
6218-
constexpr const unsigned NumOps = 3;
6219-
constexpr const AMDGPU::OpName OpNames[NumOps * 2] = {
6218+
constexpr unsigned NumOps = 3;
6219+
constexpr AMDGPU::OpName OpNames[NumOps * 2] = {
62206220
AMDGPU::OpName::src0, AMDGPU::OpName::src1,
62216221
AMDGPU::OpName::src2, AMDGPU::OpName::src0_modifiers,
62226222
AMDGPU::OpName::src1_modifiers, AMDGPU::OpName::src2_modifiers};

llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@ namespace KernelInfo {
208208
// };
209209

210210
#define KERNEL_ENVIRONMENT_IDX(MEMBER, IDX) \
211-
constexpr const unsigned MEMBER##Idx = IDX;
211+
constexpr unsigned MEMBER##Idx = IDX;
212212

213213
KERNEL_ENVIRONMENT_IDX(Configuration, 0)
214214
KERNEL_ENVIRONMENT_IDX(Ident, 1)
215215

216216
#undef KERNEL_ENVIRONMENT_IDX
217217

218218
#define KERNEL_ENVIRONMENT_CONFIGURATION_IDX(MEMBER, IDX) \
219-
constexpr const unsigned MEMBER##Idx = IDX;
219+
constexpr unsigned MEMBER##Idx = IDX;
220220

221221
KERNEL_ENVIRONMENT_CONFIGURATION_IDX(UseGenericStateMachine, 0)
222222
KERNEL_ENVIRONMENT_CONFIGURATION_IDX(MayUseNestedParallelism, 1)
@@ -258,7 +258,7 @@ KERNEL_ENVIRONMENT_CONFIGURATION_GETTER(MaxTeams)
258258

259259
GlobalVariable *
260260
getKernelEnvironementGVFromKernelInitCB(CallBase *KernelInitCB) {
261-
constexpr const int InitKernelEnvironmentArgNo = 0;
261+
constexpr int InitKernelEnvironmentArgNo = 0;
262262
return cast<GlobalVariable>(
263263
KernelInitCB->getArgOperand(InitKernelEnvironmentArgNo)
264264
->stripPointerCasts());

llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ template <char NsanTypeId>
161161
class ShadowTypeConfigImpl : public ShadowTypeConfig {
162162
public:
163163
char getNsanTypeId() const override { return NsanTypeId; }
164-
static constexpr const char kNsanTypeId = NsanTypeId;
164+
static constexpr char kNsanTypeId = NsanTypeId;
165165
};
166166

167167
// `double` (`d`) shadow type.

0 commit comments

Comments
 (0)