[clang] b1f3948 - Do not emit "-tune-cpu generic" for PS4 platform

Douglas Yung via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 12:38:18 PDT 2020


Author: Douglas Yung
Date: 2020-09-01T12:37:47-07:00
New Revision: b1f394862053867cdc6b2300e725e053504519d5

URL: https://github.com/llvm/llvm-project/commit/b1f394862053867cdc6b2300e725e053504519d5
DIFF: https://github.com/llvm/llvm-project/commit/b1f394862053867cdc6b2300e725e053504519d5.diff

LOG: 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

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/ps4-cpu-defaults.cpp

Removed: 
    


################################################################################
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"


        


More information about the cfe-commits mailing list