[clang] [clang][driver] Enable frame pointers by default for Fuchsia targets (PR #114483)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 16:05:54 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Paul Kirth (ilovepi)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/114483.diff
3 Files Affected:
- (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+3-3)
- (modified) clang/test/Driver/frame-pointer-elim.c (+9)
- (modified) clang/test/Driver/frame-pointer.c (+18-10)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 1c3c8c816594e5..a4f28e132e5112 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -79,7 +79,7 @@ static bool useFramePointerForTargetByDefault(const llvm::opt::ArgList &Args,
!Args.hasArg(clang::driver::options::OPT_mfentry))
return true;
- if (Triple.isAndroid())
+ if (Triple.isAndroid() || Triple.isOSFuchsia())
return true;
switch (Triple.getArch()) {
@@ -110,7 +110,7 @@ static bool useFramePointerForTargetByDefault(const llvm::opt::ArgList &Args,
break;
}
- if (Triple.isOSFuchsia() || Triple.isOSNetBSD()) {
+ if (Triple.isOSNetBSD()) {
return !clang::driver::tools::areOptimizationsEnabled(Args);
}
@@ -156,7 +156,7 @@ static bool useFramePointerForTargetByDefault(const llvm::opt::ArgList &Args,
static bool useLeafFramePointerForTargetByDefault(const llvm::Triple &Triple) {
if (Triple.isAArch64() || Triple.isPS() || Triple.isVE() ||
- (Triple.isAndroid() && !Triple.isARM()))
+ (Triple.isAndroid() && !Triple.isARM()) || Triple.isOSFuchsia())
return false;
return true;
diff --git a/clang/test/Driver/frame-pointer-elim.c b/clang/test/Driver/frame-pointer-elim.c
index cdedcc7ae4c89f..77a26fb42dfbad 100644
--- a/clang/test/Driver/frame-pointer-elim.c
+++ b/clang/test/Driver/frame-pointer-elim.c
@@ -105,6 +105,13 @@
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
// RUN: %clang -### --target=aarch64-linux-android -S -Os %s 2>&1 | \
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
+// RUN: %clang -### --target=aarch64-unknown-fuchsia -S %s 2>&1 | \
+// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
+// RUN: %clang -### --target=aarch64-unknown-fuchsia -S -O2 %s 2>&1 | \
+// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
+// RUN: %clang -### --target=aarch64-unknown-fuchsia -S -Os %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
@@ -162,5 +169,7 @@
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
// RUN: not %clang -### --target=riscv64-linux-android -mbig-endian -O1 -S %s 2>&1 | \
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
+// RUN: %clang -### --target=riscv64-unknown-fuchsia -O1 -S %s 2>&1 | \
+// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
void f0() {}
void f1() { f0(); }
diff --git a/clang/test/Driver/frame-pointer.c b/clang/test/Driver/frame-pointer.c
index 2015fa520c2a2e..112fe8bf741025 100644
--- a/clang/test/Driver/frame-pointer.c
+++ b/clang/test/Driver/frame-pointer.c
@@ -4,9 +4,9 @@
// RUN: %clang --target=i386-pc-linux -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK3-32 %s
// RUN: %clang --target=i386-pc-linux -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECKs-32 %s
-// RUN: %clang --target=i386-linux-android -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
-// RUN: %clang --target=i386-linux-android -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
-// RUN: %clang --target=i386-linux-android -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
+// RUN: %clang --target=i386-linux-android -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=i386-linux-android -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=i386-linux-android -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
// RUN: %clang --target=x86_64-pc-linux -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
// RUN: %clang --target=x86_64-pc-linux -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
@@ -15,9 +15,13 @@
// RUN: %clang --target=x86_64-pc-linux -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECKs-64 %s
// RUN: %clang --target=x86_64-pc-win32-macho -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-MACHO-64 %s
-// RUN: %clang --target=x86_64-linux-android -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
-// RUN: %clang --target=x86_64-linux-android -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
-// RUN: %clang --target=x86_64-linux-android -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
+// RUN: %clang --target=x86_64-linux-android -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=x86_64-linux-android -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=x86_64-linux-android -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+
+// RUN: %clang --target=x86_64-unknown-fuchsia -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=x86_64-unknown-fuchsia -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=x86_64-unknown-fuchsia -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
// Trust the above to get the optimizations right, and just test other targets
// that want this by default.
@@ -64,9 +68,13 @@
// RUN: %clang --target=riscv64-unknown-linux-gnu -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK3-64 %s
// RUN: %clang --target=riscv64-unknown-linux-gnu -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECKs-64 %s
-// RUN: %clang --target=riscv64-linux-android -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
-// RUN: %clang --target=riscv64-linux-android -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
-// RUN: %clang --target=riscv64-linux-android -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-ANDROID %s
+// RUN: %clang --target=riscv64-linux-android -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=riscv64-linux-android -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=riscv64-linux-android -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+//
+// RUN: %clang --target=riscv64-unknown-fuchsia -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=riscv64-unknown-fuchsia -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
+// RUN: %clang --target=riscv64-unknown-fuchsia -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-NONLEAF %s
// RUN: %clang --target=loongarch32 -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
// RUN: %clang --target=loongarch32 -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-32 %s
@@ -93,4 +101,4 @@
// CHECKs-64-NOT: -mframe-pointer=all
// CHECK-MACHO-64: -mframe-pointer=all
-// CHECK-ANDROID: -mframe-pointer=non-leaf
+// CHECK-NONLEAF: -mframe-pointer=non-leaf
``````````
</details>
https://github.com/llvm/llvm-project/pull/114483
More information about the cfe-commits
mailing list