[llvm] [CodeGenTypes] Remove redundant declarations (NFC) (PR #165972)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 31 22:40:05 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/165972
In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.
This patch also removes redundant "const" from the in-class definitions.
Identified with readability-redundant-declaration.
>From a9f4013d3ad3b141bc77abca0776330b5170a47c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 30 Oct 2025 07:53:15 -0700
Subject: [PATCH] [CodeGenTypes] Remove redundant declarations (NFC)
In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.
This patch also removes redundant "const" from the in-class definitions.
Identified with readability-redundant-declaration.
---
llvm/include/llvm/CodeGenTypes/LowLevelType.h | 10 +++++-----
llvm/lib/CodeGenTypes/LowLevelType.cpp | 6 ------
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/llvm/include/llvm/CodeGenTypes/LowLevelType.h b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
index 4c1fe13790011..472a3f3e23b3f 100644
--- a/llvm/include/llvm/CodeGenTypes/LowLevelType.h
+++ b/llvm/include/llvm/CodeGenTypes/LowLevelType.h
@@ -340,18 +340,18 @@ class LLT {
/// valid encodings, SizeInBits/SizeOfElement must be larger than 0.
/// * Non-pointer scalar (isPointer == 0 && isVector == 0):
/// SizeInBits: 32;
- static const constexpr BitFieldInfo ScalarSizeFieldInfo{32, 29};
+ static constexpr BitFieldInfo ScalarSizeFieldInfo{32, 29};
/// * Pointer (isPointer == 1 && isVector == 0):
/// SizeInBits: 16;
/// AddressSpace: 24;
- static const constexpr BitFieldInfo PointerSizeFieldInfo{16, 45};
- static const constexpr BitFieldInfo PointerAddressSpaceFieldInfo{24, 21};
+ static constexpr BitFieldInfo PointerSizeFieldInfo{16, 45};
+ static constexpr BitFieldInfo PointerAddressSpaceFieldInfo{24, 21};
/// * Vector-of-non-pointer (isPointer == 0 && isVector == 1):
/// NumElements: 16;
/// SizeOfElement: 32;
/// Scalable: 1;
- static const constexpr BitFieldInfo VectorElementsFieldInfo{16, 5};
- static const constexpr BitFieldInfo VectorScalableFieldInfo{1, 0};
+ static constexpr BitFieldInfo VectorElementsFieldInfo{16, 5};
+ static constexpr BitFieldInfo VectorScalableFieldInfo{1, 0};
/// * Vector-of-pointer (isPointer == 1 && isVector == 1):
/// NumElements: 16;
/// SizeOfElement: 16;
diff --git a/llvm/lib/CodeGenTypes/LowLevelType.cpp b/llvm/lib/CodeGenTypes/LowLevelType.cpp
index 4785f2652b00e..92b7fad3a0e24 100644
--- a/llvm/lib/CodeGenTypes/LowLevelType.cpp
+++ b/llvm/lib/CodeGenTypes/LowLevelType.cpp
@@ -54,9 +54,3 @@ LLVM_DUMP_METHOD void LLT::dump() const {
dbgs() << '\n';
}
#endif
-
-const constexpr LLT::BitFieldInfo LLT::ScalarSizeFieldInfo;
-const constexpr LLT::BitFieldInfo LLT::PointerSizeFieldInfo;
-const constexpr LLT::BitFieldInfo LLT::PointerAddressSpaceFieldInfo;
-const constexpr LLT::BitFieldInfo LLT::VectorElementsFieldInfo;
-const constexpr LLT::BitFieldInfo LLT::VectorScalableFieldInfo;
More information about the llvm-commits
mailing list