summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Yung <douglas.yung@sony.com>2020-09-01 12:36:14 -0700
committerDouglas Yung <douglas.yung@sony.com>2020-09-01 12:37:47 -0700
commitb1f394862053867cdc6b2300e725e053504519d5 (patch)
tree87271ceb6adbf43229961cae18513080f0bb6ea8
parent3e753ce1ab5288f1fa5fb03711474ac2800e2f14 (diff)
downloadllvm-b1f394862053867cdc6b2300e725e053504519d5.tar.gz
Do not emit "-tune-cpu generic" for PS4 platform
For the PS4, do not emit "-tune-cpu generic" since the platform only has 1 known CPU and we do not want to prevent optimizations by tuning for a generic rather than the specific processor it contains. Reviewed By: probinson Differential Revision: https://reviews.llvm.org/D86965
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp5
-rw-r--r--clang/test/Driver/ps4-cpu-defaults.cpp3
2 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 976502c3ca73..3023c94bf10c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2075,9 +2075,10 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
// Handle -mtune.
- // Default to "generic" unless -march is present.
+ // Default to "generic" unless -march is present or targetting the PS4.
std::string TuneCPU;
- if (!Args.hasArg(clang::driver::options::OPT_march_EQ))
+ if (!Args.hasArg(clang::driver::options::OPT_march_EQ) &&
+ !getToolChain().getTriple().isPS4CPU())
TuneCPU = "generic";
// Override based on -mtune.
diff --git a/clang/test/Driver/ps4-cpu-defaults.cpp b/clang/test/Driver/ps4-cpu-defaults.cpp
index 99547d4e02a2..46fa8897e6fa 100644
--- a/clang/test/Driver/ps4-cpu-defaults.cpp
+++ b/clang/test/Driver/ps4-cpu-defaults.cpp
@@ -1,6 +1,7 @@
// Check that on the PS4 we default to:
-// -target-cpu btver2 and no exceptions
+// -target-cpu btver2, no exceptions and not -tune-cpu generic
// RUN: %clang -target x86_64-scei-ps4 -c %s -### 2>&1 | FileCheck %s
// CHECK: "-target-cpu" "btver2"
// CHECK-NOT: exceptions
+// CHECK-NOT: "-tune-cpu"