r365862 - [PowerPC] Default to -fomit-frame-pointer when optimization is enabled

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 11 19:14:08 PDT 2019


Author: maskray
Date: Thu Jul 11 19:14:08 2019
New Revision: 365862

URL: http://llvm.org/viewvc/llvm-project?rev=365862&view=rev
Log:
[PowerPC] Default to -fomit-frame-pointer when optimization is enabled

NetBSD, Linux, CloudABI and Hurd already omit frame pointer for PowerPC.
Make it do so for other platforms.

Modified:
    cfe/trunk/lib/Driver/ToolChains/Clang.cpp
    cfe/trunk/test/Driver/frame-pointer-elim.c

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=365862&r1=365861&r2=365862&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Jul 11 19:14:08 2019
@@ -528,6 +528,9 @@ static bool useFramePointerForTargetByDe
     // XCore never wants frame pointers, regardless of OS.
     // WebAssembly never wants frame pointers.
     return false;
+  case llvm::Triple::ppc:
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
   case llvm::Triple::riscv32:
   case llvm::Triple::riscv64:
     return !areOptimizationsEnabled(Args);
@@ -547,9 +550,6 @@ static bool useFramePointerForTargetByDe
     case llvm::Triple::mips64el:
     case llvm::Triple::mips:
     case llvm::Triple::mipsel:
-    case llvm::Triple::ppc:
-    case llvm::Triple::ppc64:
-    case llvm::Triple::ppc64le:
     case llvm::Triple::systemz:
     case llvm::Triple::x86:
     case llvm::Triple::x86_64:

Modified: cfe/trunk/test/Driver/frame-pointer-elim.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/frame-pointer-elim.c?rev=365862&r1=365861&r2=365862&view=diff
==============================================================================
--- cfe/trunk/test/Driver/frame-pointer-elim.c (original)
+++ cfe/trunk/test/Driver/frame-pointer-elim.c Thu Jul 11 19:14:08 2019
@@ -94,5 +94,10 @@
 // RUN: %clang -### -target x86_64-scei-ps4 -S -O2 %s 2>&1 | \
 // RUN:   FileCheck --check-prefix=KEEP-NON-LEAF %s
 
+// RUN: %clang -### -target powerpc64 -S %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-ALL %s
+// RUN: %clang -### -target powerpc64 -S -O1 %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=KEEP-NONE %s
+
 void f0() {}
 void f1() { f0(); }




More information about the cfe-commits mailing list