[PATCH] D107473: [LLVM][LTO][NFC] Resolve FIXME in ThinLTOCodeGenerator.cpp
Alf via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 7 16:42:54 PDT 2021
gAlfonso-bit updated this revision to Diff 364990.
gAlfonso-bit added a comment.
Mirrored changes into LTOCodeGenerator.cpp, since the original code was from there.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107473/new/
https://reviews.llvm.org/D107473
Files:
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Index: llvm/lib/LTO/ThinLTOCodeGenerator.cpp
===================================================================
--- llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -588,15 +588,20 @@
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:
+ default:
TMBuilder.MCpu = "cyclone";
+ break;
+ }
}
TMBuilder.TheTriple = std::move(TheTriple);
}
Index: llvm/lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- llvm/lib/LTO/LTOCodeGenerator.cpp
+++ llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -339,15 +339,19 @@
FeatureStr = Features.getString();
// Set a default CPU for Darwin triples.
if (Config.CPU.empty() && Triple.isOSDarwin()) {
- if (Triple.getArch() == llvm::Triple::x86_64)
+ switch (Triple.getArch()) {
+ case llvm::Triple::x86_64:
Config.CPU = "core2";
- else if (Triple.getArch() == llvm::Triple::x86)
+ break;
+ case llvm::Triple::x86:
Config.CPU = "yonah";
- else if (Triple.isArm64e())
- Config.CPU = "apple-a12";
- else if (Triple.getArch() == llvm::Triple::aarch64 ||
- Triple.getArch() == llvm::Triple::aarch64_32)
+ break;
+ case llvm::Triple::aarch64:
+ case llvm::Triple::aarch64_32:
+ default:
Config.CPU = "cyclone";
+ break;
+ }
}
TargetMach = createTargetMachine();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107473.364990.patch
Type: text/x-patch
Size: 2120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210807/64b9efeb/attachment.bin>
More information about the llvm-commits
mailing list