diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -36,7 +36,6 @@ #include "llvm/IR/Verifier.h" #include "llvm/IRReader/IRReader.h" #include "llvm/LTO/LTO.h" -#include "llvm/LTO/SummaryBasedOptimizations.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Object/IRObjectFile.h" #include "llvm/Passes/PassBuilder.h" @@ -47,7 +46,6 @@ #include "llvm/Support/Error.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/Path.h" -#include "llvm/Support/SHA1.h" #include "llvm/Support/SmallVectorMemoryBuffer.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/ThreadPool.h" @@ -588,15 +586,19 @@ static void initTMBuilder(TargetMachineBuilder &TMBuilder, const Triple &TheTriple) { // Set a default CPU for Darwin triples (copied from LTOCodeGenerator). - // FIXME this looks pretty terrible... if (TMBuilder.MCpu.empty() && TheTriple.isOSDarwin()) { - if (TheTriple.getArch() == llvm::Triple::x86_64) + switch (TheTriple.getArch()) { + case llvm::Triple::x86_64: TMBuilder.MCpu = "core2"; - else if (TheTriple.getArch() == llvm::Triple::x86) + break; + case llvm::Triple::x86: TMBuilder.MCpu = "yonah"; - else if (TheTriple.getArch() == llvm::Triple::aarch64 || - TheTriple.getArch() == llvm::Triple::aarch64_32) + break; + case llvm::Triple::aarch64: + case llvm::Triple::aarch64_32: TMBuilder.MCpu = "cyclone"; + break; + } } TMBuilder.TheTriple = std::move(TheTriple); }