[clang] 94b3c19 - [M68k][clang] Enable frame pointer optimization by default (#87264)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 12 21:39:33 PDT 2024
Author: Jim Lin
Date: 2024-04-13T12:39:30+08:00
New Revision: 94b3c192d3468752e6bc2f20957d433bccdb8ff3
URL: https://github.com/llvm/llvm-project/commit/94b3c192d3468752e6bc2f20957d433bccdb8ff3
DIFF: https://github.com/llvm/llvm-project/commit/94b3c192d3468752e6bc2f20957d433bccdb8ff3.diff
LOG: [M68k][clang] Enable frame pointer optimization by default (#87264)
Enable frame pointer optimization by default to match it with gcc.
Fixes: https://github.com/llvm/llvm-project/issues/75013
Added:
Modified:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/frame-pointer-elim.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 62a53b85ce098b..f10aa4dfaa9ddd 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -114,6 +114,7 @@ static bool useFramePointerForTargetByDefault(const llvm::opt::ArgList &Args,
case llvm::Triple::csky:
case llvm::Triple::loongarch32:
case llvm::Triple::loongarch64:
+ case llvm::Triple::m68k:
return !clang::driver::tools::areOptimizationsEnabled(Args);
default:
break;
diff --git a/clang/test/Driver/frame-pointer-elim.c b/clang/test/Driver/frame-pointer-elim.c
index 847c5b7b0b01f3..e1b0a468ab8259 100644
--- a/clang/test/Driver/frame-pointer-elim.c
+++ b/clang/test/Driver/frame-pointer-elim.c
@@ -125,6 +125,12 @@
// RUN: %clang -### -target sparc64 -S -O1 %s 2>&1 | \
// RUN: FileCheck --check-prefix=KEEP-NONE %s
+// M68k targets omit the frame pointer when optimizations are enabled.
+// RUN: %clang -### -target m68k -S %s 2>&1 | \
+// RUN: FileCheck --check-prefix=KEEP-ALL %s
+// RUN: %clang -### -target m68k -S -O1 %s 2>&1 | \
+// RUN: FileCheck --check-prefix=KEEP-NONE %s
+
// For AAarch32 (A32, T32) linux targets, default omit frame pointer when
// optimizations are enabled.
// RUN: %clang -### -target arm-linux-gnueabihf- -marm -S %s 2>&1 | \
More information about the cfe-commits
mailing list