[PATCH] D60335: Use -fomit-frame-pointer when optimizing PowerPC code
George Koehler via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 5 12:50:42 PDT 2019
kernigh created this revision.
kernigh added reviewers: joerg, brad, cfe-commits.
Herald added subscribers: jsji, krytarowski, nemanjai.
Herald added a project: clang.
This enables -fomit-frame-pointer when optimizing code for all PowerPC
targets, instead of only Linux and NetBSD.
I mailed this patch to cfe-commits earlier this week.
Roman Lebedev and Hal Finkel pointed me to Phabricator;
this is my first attempt to use Phabricator.
My earlier mail wrote:
> The attached patch is for clang to use -fomit-frame-pointer by default
> for all PowerPC targets when optimizing code. Right now, clang uses
> -fomit-frame-pointer for PowerPC Linux and NetBSD but not for other
> targets. I have been running `clang -target powerpc-openbsd`.
>
> The patch is for llvm-project.git master. I previously posted this
> patch to https://bugs.llvm.org/show_bug.cgi?id=41094 , but the patch
> in this email is for a newer revision of master.
>
> In most functions, the frame pointer in r31 is an unnecessary extra
> copy of the stack pointer in r1. GCC is using -fomit-frame-pointer by
> default (in my PowerPC machine running OpenBSD/macppc); I want Clang
> to be at least as good as GCC. Also, this patch helps me to compare
> the output of `clang -target powerpc-openbsd -O2 -S` with the output
> for Linux or NetBSD. In bug 41094, I showed how -fomit-frame-pointer
> simplifies the C function `void nothing(void) {}`.
Repository:
rC Clang
https://reviews.llvm.org/D60335
Files:
clang/lib/Driver/ToolChains/Clang.cpp
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -523,8 +523,12 @@
// 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:
+ // PowerPC's frame pointer is often an extra copy of the stack pointer.
return !areOptimizationsEnabled(Args);
default:
break;
@@ -542,9 +546,6 @@
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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60335.193936.patch
Type: text/x-patch
Size: 942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190405/fe2d7435/attachment-0001.bin>
More information about the cfe-commits
mailing list