r337274 - For NetBSD, unwind data is emitted by default, so also enable frame
Joerg Sonnenberger via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 17 05:38:57 PDT 2018
Author: joerg
Date: Tue Jul 17 05:38:57 2018
New Revision: 337274
URL: http://llvm.org/viewvc/llvm-project?rev=337274&view=rev
Log:
For NetBSD, unwind data is emitted by default, so also enable frame
pointer optimisation by default when using optimisation.
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=337274&r1=337273&r2=337274&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Jul 17 05:38:57 2018
@@ -524,6 +524,10 @@ static bool useFramePointerForTargetByDe
break;
}
+ if (Triple.getOS() == llvm::Triple::NetBSD) {
+ return !areOptimizationsEnabled(Args);
+ }
+
if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI) {
switch (Triple.getArch()) {
// Don't use a frame pointer on linux if optimizing for certain targets.
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=337274&r1=337273&r2=337274&view=diff
==============================================================================
--- cfe/trunk/test/Driver/frame-pointer-elim.c (original)
+++ cfe/trunk/test/Driver/frame-pointer-elim.c Tue Jul 17 05:38:57 2018
@@ -17,6 +17,15 @@
// RUN: FileCheck --check-prefix=CLOUDABI %s
// CLOUDABI-NOT: "-momit-leaf-frame-pointer"
+// NetBSD follows the same rules as Linux.
+// RUN: %clang -### -target x86_64-unknown-netbsd -S -O1 %s 2>&1 | \
+// RUN: FileCheck --check-prefix=NETBSD-OPT %s
+// NETBSD-OPT: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -target x86_64-unknown-netbsd -S %s 2>&1 | \
+// RUN: FileCheck --check-prefix=NETBSD %s
+// NETBSD-NOT: "-momit-leaf-frame-pointer"
+
// Darwin disables omitting the leaf frame pointer even under optimization
// unless the command lines are given.
// RUN: %clang -### -target i386-apple-darwin -S %s 2>&1 | \
More information about the cfe-commits
mailing list