Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clang/lib/Driver/ToolChains/CommonArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions clang/test/Driver/frame-pointer-elim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(); }
28 changes: 18 additions & 10 deletions clang/test/Driver/frame-pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Loading