Skip to content

Commit 80a0973

Browse files
Revert "[clang][AArch64] Add getHostCPUFeatures to query for enabled … (#114066)
…features in cpu info (#97749)" This reverts commit d732c0b. This is breaking buildbots https://lab.llvm.org/buildbot/#/builders/190/builds/8413, https://lab.llvm.org/buildbot/#/builders/56/builds/10880 and a few others.
1 parent 2e612f8 commit 80a0973

File tree

8 files changed

+10
-198
lines changed

8 files changed

+10
-198
lines changed

clang/lib/Driver/ToolChains/Arch/AArch64.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,21 +135,15 @@ getAArch64ArchFeaturesFromMarch(const Driver &D, StringRef March,
135135
return true;
136136
}
137137

138-
static bool getAArch64ArchFeaturesFromMcpu(
139-
const Driver &D, StringRef Mcpu, const ArgList &Args,
140-
llvm::AArch64::ExtensionSet &Extensions, std::vector<StringRef> &Features) {
138+
static bool
139+
getAArch64ArchFeaturesFromMcpu(const Driver &D, StringRef Mcpu,
140+
const ArgList &Args,
141+
llvm::AArch64::ExtensionSet &Extensions) {
141142
StringRef CPU;
142143
std::string McpuLowerCase = Mcpu.lower();
143144
if (!DecodeAArch64Mcpu(D, McpuLowerCase, CPU, Extensions))
144145
return false;
145146

146-
if (Mcpu == "native") {
147-
llvm::StringMap<bool> HostFeatures = llvm::sys::getHostCPUFeatures();
148-
for (auto &[Feature, Enabled] : HostFeatures) {
149-
Features.push_back(Args.MakeArgString((Enabled ? "+" : "-") + Feature));
150-
}
151-
}
152-
153147
return true;
154148
}
155149

@@ -216,11 +210,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
216210
success =
217211
getAArch64ArchFeaturesFromMarch(D, A->getValue(), Args, Extensions);
218212
else if ((A = Args.getLastArg(options::OPT_mcpu_EQ)))
219-
success = getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Extensions,
220-
Features);
213+
success =
214+
getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Extensions);
221215
else if (isCPUDeterminedByTriple(Triple))
222216
success = getAArch64ArchFeaturesFromMcpu(
223-
D, getAArch64TargetCPU(Args, Triple, A), Args, Extensions, Features);
217+
D, getAArch64TargetCPU(Args, Triple, A), Args, Extensions);
224218
else
225219
// Default to 'A' profile if the architecture is not specified.
226220
success = getAArch64ArchFeaturesFromMarch(D, "armv8-a", Args, Extensions);

clang/test/Driver/Inputs/cpunative/cortex-a57

Lines changed: 0 additions & 8 deletions
This file was deleted.

clang/test/Driver/Inputs/cpunative/cortex-a72

Lines changed: 0 additions & 8 deletions
This file was deleted.

clang/test/Driver/Inputs/cpunative/cortex-a76

Lines changed: 0 additions & 8 deletions
This file was deleted.

clang/test/Driver/Inputs/cpunative/neoverse-n1

Lines changed: 0 additions & 8 deletions
This file was deleted.

clang/test/Driver/Inputs/cpunative/neoverse-v2

Lines changed: 0 additions & 8 deletions
This file was deleted.

clang/test/Driver/aarch64-mcpu-native.c

Lines changed: 0 additions & 138 deletions
This file was deleted.

llvm/lib/TargetParser/Host.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,11 @@ using namespace llvm;
6868

6969
static std::unique_ptr<llvm::MemoryBuffer>
7070
LLVM_ATTRIBUTE_UNUSED getProcCpuinfoContent() {
71-
const char *CPUInfoFile = "/proc/cpuinfo";
72-
if (const char *CpuinfoIntercept = std::getenv("LLVM_CPUINFO"))
73-
CPUInfoFile = CpuinfoIntercept;
7471
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Text =
75-
llvm::MemoryBuffer::getFileAsStream(CPUInfoFile);
76-
72+
llvm::MemoryBuffer::getFileAsStream("/proc/cpuinfo");
7773
if (std::error_code EC = Text.getError()) {
78-
llvm::errs() << "Can't read " << CPUInfoFile << ": " << EC.message()
79-
<< "\n";
74+
llvm::errs() << "Can't read "
75+
<< "/proc/cpuinfo: " << EC.message() << "\n";
8076
return nullptr;
8177
}
8278
return std::move(*Text);

0 commit comments

Comments
 (0)