]> granicus.if.org Git - clang/commitdiff
Enable frame pointer elimination for OpenBSD on x86 and mips64.
authorBrad Smith <brad@comstyle.com>
Fri, 12 Apr 2019 01:29:18 +0000 (01:29 +0000)
committerBrad Smith <brad@comstyle.com>
Fri, 12 Apr 2019 01:29:18 +0000 (01:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358245 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Clang.cpp
test/Driver/frame-pointer-elim.c

index a5b98aad54d856739bb295ba83d4cb612448bed4..18856650a949e75fc8077f51be249a3507b37193 100644 (file)
@@ -534,6 +534,18 @@ static bool useFramePointerForTargetByDefault(const ArgList &Args,
     return !areOptimizationsEnabled(Args);
   }
 
+  if (Triple.isOSOpenBSD()) {
+    switch (Triple.getArch()) {
+    case llvm::Triple::mips64:
+    case llvm::Triple::mips64el:
+    case llvm::Triple::x86:
+    case llvm::Triple::x86_64:
+      return !areOptimizationsEnabled(Args);
+    default:
+      return true;
+    }
+  }
+
   if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI ||
       Triple.isOSHurd()) {
     switch (Triple.getArch()) {
index 6fcd3eb75ae591ad66bcfccf130a875e2fa48000..b050f71611e7923152e0249830762271761534ea 100644 (file)
 // RUN:   FileCheck --check-prefix=NETBSD %s
 // NETBSD-NOT: "-momit-leaf-frame-pointer"
 
+// OpenBSD follows the same rules as Linux.
+// RUN: %clang -### -target x86_64-unknown-openbsd -S -O1 %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=OPENBSD-OPT %s
+// OPENBSD-OPT: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -target x86_64-unknown-openbsd -S %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=OPENBSD %s
+// OPENBSD-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 | \