For NetBSD, unwind data is emitted by default, so also enable frame

pointer optimisation by default when using optimisation.

llvm-svn: 337274
This commit is contained in:
Joerg Sonnenberger 2018-07-17 12:38:57 +00:00
parent e1016f1bc7
commit 2ad8210725
2 changed files with 13 additions and 0 deletions

View File

@ -524,6 +524,10 @@ static bool useFramePointerForTargetByDefault(const ArgList &Args,
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.

View File

@ -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 | \