[llvm] 96bde11 - [TargetParser] Remove const from a return type (NFC) (#149255)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 17 07:22:55 PDT 2025
Author: Kazu Hirata
Date: 2025-07-17T07:22:51-07:00
New Revision: 96bde11e307e53a1263ab6088f172716db7cb0d8
URL: https://github.com/llvm/llvm-project/commit/96bde11e307e53a1263ab6088f172716db7cb0d8
DIFF: https://github.com/llvm/llvm-project/commit/96bde11e307e53a1263ab6088f172716db7cb0d8.diff
LOG: [TargetParser] Remove const from a return type (NFC) (#149255)
getHostCPUFeatures constructs and returns a temporary instance of
StringMap<bool>. We don't need const on the return type.
Added:
Modified:
llvm/include/llvm/TargetParser/Host.h
llvm/lib/TargetParser/Host.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/TargetParser/Host.h b/llvm/include/llvm/TargetParser/Host.h
index be3d41e022ad9..40a9b6cc13902 100644
--- a/llvm/include/llvm/TargetParser/Host.h
+++ b/llvm/include/llvm/TargetParser/Host.h
@@ -53,7 +53,7 @@ LLVM_ABI StringRef getHostCPUName();
/// which features may appear in this map, except that they are all valid LLVM
/// feature names. The map can be empty, for example if feature detection
/// fails.
-LLVM_ABI const StringMap<bool, MallocAllocator> getHostCPUFeatures();
+LLVM_ABI StringMap<bool, MallocAllocator> getHostCPUFeatures();
/// This is a function compatible with cl::AddExtraVersionPrinter, which adds
/// info about the current target triple and detected CPU.
diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp
index 8fd91fcd33f63..78bd5b4b5bd25 100644
--- a/llvm/lib/TargetParser/Host.cpp
+++ b/llvm/lib/TargetParser/Host.cpp
@@ -1855,7 +1855,7 @@ VendorSignatures getVendorSignature(unsigned *MaxLeaf) {
#if defined(__i386__) || defined(_M_IX86) || \
defined(__x86_64__) || defined(_M_X64)
-const StringMap<bool> sys::getHostCPUFeatures() {
+StringMap<bool> sys::getHostCPUFeatures() {
unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
unsigned MaxLevel;
StringMap<bool> Features;
@@ -2068,7 +2068,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
return Features;
}
#elif defined(__linux__) && (defined(__arm__) || defined(__aarch64__))
-const StringMap<bool> sys::getHostCPUFeatures() {
+StringMap<bool> sys::getHostCPUFeatures() {
StringMap<bool> Features;
std::unique_ptr<llvm::MemoryBuffer> P = getProcCpuinfoContent();
if (!P)
@@ -2148,7 +2148,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
return Features;
}
#elif defined(_WIN32) && (defined(__aarch64__) || defined(_M_ARM64))
-const StringMap<bool> sys::getHostCPUFeatures() {
+StringMap<bool> sys::getHostCPUFeatures() {
StringMap<bool> Features;
// If we're asking the OS at runtime, believe what the OS says
@@ -2167,7 +2167,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
}
#elif defined(__linux__) && defined(__loongarch__)
#include <sys/auxv.h>
-const StringMap<bool> sys::getHostCPUFeatures() {
+StringMap<bool> sys::getHostCPUFeatures() {
unsigned long hwcap = getauxval(AT_HWCAP);
bool HasFPU = hwcap & (1UL << 3); // HWCAP_LOONGARCH_FPU
uint32_t cpucfg2 = 0x2, cpucfg3 = 0x3;
@@ -2196,7 +2196,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
return Features;
}
#elif defined(__linux__) && defined(__riscv)
-const StringMap<bool> sys::getHostCPUFeatures() {
+StringMap<bool> sys::getHostCPUFeatures() {
RISCVHwProbe Query[]{{/*RISCV_HWPROBE_KEY_BASE_BEHAVIOR=*/3, 0},
{/*RISCV_HWPROBE_KEY_IMA_EXT_0=*/4, 0},
{/*RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF=*/9, 0}};
@@ -2279,7 +2279,7 @@ const StringMap<bool> sys::getHostCPUFeatures() {
return Features;
}
#else
-const StringMap<bool> sys::getHostCPUFeatures() { return {}; }
+StringMap<bool> sys::getHostCPUFeatures() { return {}; }
#endif
#if __APPLE__
More information about the llvm-commits
mailing list