[PATCH] D81115: [PowerPC] Do not special case Darwin on PowerPC in target cpu handling
Steven Wan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 4 14:23:51 PDT 2020
stevewan updated this revision to Diff 268588.
stevewan added a comment.
Reduce the nested 'if' and reorder it to prefer the more likely case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81115/new/
https://reviews.llvm.org/D81115
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,19 +294,19 @@
std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
// LLVM may default to generating code for the native CPU,
// but, like gcc, we default to a more generic option for
- // each architecture. (except on AIX or Darwin)
- if (TargetCPUName.empty()) {
- if (T.isOSAIX())
- TargetCPUName = "pwr4";
- else if (!T.isOSDarwin()) {
- if (T.getArch() == llvm::Triple::ppc64)
- TargetCPUName = "ppc64";
- else if (T.getArch() == llvm::Triple::ppc64le)
- TargetCPUName = "ppc64le";
- else
- TargetCPUName = "ppc";
- }
- }
+ // each architecture. (except on AIX)
+ if (!TargetCPUName.empty())
+ return TargetCPUName;
+
+ if (T.isOSAIX())
+ TargetCPUName = "pwr4";
+ else if (T.getArch() == llvm::Triple::ppc64le)
+ TargetCPUName = "ppc64le";
+ else if (T.getArch() == llvm::Triple::ppc64)
+ TargetCPUName = "ppc64";
+ else
+ TargetCPUName = "ppc";
+
return TargetCPUName;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81115.268588.patch
Type: text/x-patch
Size: 1248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200604/a85251e1/attachment.bin>
More information about the cfe-commits
mailing list