[Driver][AArch64] Simplify -mtune

llvm::sys::getHostCPUName()'s return value is not empty. `-mtune=` (empty value)
has caused a driver error. So we can omit `!TuneCPU.empty()` check.
This commit is contained in:
Fangrui Song 2022-07-22 14:19:27 -07:00
parent ff1920d106
commit 475e526d85
1 changed files with 4 additions and 11 deletions

View File

@ -1923,18 +1923,11 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
AddAAPCSVolatileBitfieldArgs(Args, CmdArgs); AddAAPCSVolatileBitfieldArgs(Args, CmdArgs);
if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_mtune_EQ)) { if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_mtune_EQ)) {
StringRef Name = A->getValue(); CmdArgs.push_back("-tune-cpu");
if (strcmp(A->getValue(), "native") == 0)
std::string TuneCPU; CmdArgs.push_back(Args.MakeArgString(llvm::sys::getHostCPUName()));
if (Name == "native")
TuneCPU = std::string(llvm::sys::getHostCPUName());
else else
TuneCPU = std::string(Name); CmdArgs.push_back(A->getValue());
if (!TuneCPU.empty()) {
CmdArgs.push_back("-tune-cpu");
CmdArgs.push_back(Args.MakeArgString(TuneCPU));
}
} }
AddUnalignedAccessWarning(CmdArgs); AddUnalignedAccessWarning(CmdArgs);