[PATCH] D55915: [Driver] Make -fno-omit-frame-pointer imply -mno-omit-leaf-frame-pointer
Yuanfang Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 21 11:49:11 PST 2018
tabloid.adroit updated this revision to Diff 179325.
tabloid.adroit added a comment.
- [Driver] Make -fno-omit-frame-pointer imply -mno-omit-leaf-frame-pointer
- add test
- update
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55915/new/
https://reviews.llvm.org/D55915
Files:
lib/CodeGen/CGCall.cpp
lib/Driver/ToolChains/Clang.cpp
test/Driver/cl-options.c
test/Driver/frame-pointer-elim.c
Index: test/Driver/frame-pointer-elim.c
===================================================================
--- test/Driver/frame-pointer-elim.c
+++ test/Driver/frame-pointer-elim.c
@@ -69,5 +69,30 @@
// RUN: %clang -### -target x86_64-scei-ps4 -S -O2 %s 2>&1 | \
// RUN: FileCheck --check-prefix=OMIT_LEAF %s
+// RUN: %clang -### -S -Os -fno-omit-frame-pointer %s 2>&1 | \
+// RUN: FileCheck --check-prefix=NO-OMIT-ALL %s
+// NO-OMIT-ALL: "-mdisable-fp-elim"
+// NO-OMIT-ALL-NOT: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -S -Os -fno-omit-frame-pointer -momit-leaf-frame-pointer %s 2>&1 | \
+// RUN: FileCheck --check-prefix=NO-OMIT-NONLEAF %s
+// NO-OMIT-NONLEAF: "-mdisable-fp-elim"
+// NO-OMIT-NONLEAF: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -S -Os -fomit-frame-pointer %s 2>&1 | \
+// RUN: FileCheck --check-prefix=OMIT-ALL %s
+// OMIT-ALL-NOT: "-mdisable-fp-elim"
+// OMIT-ALL: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -S -Os -fomit-frame-pointer -momit-leaf-frame-pointer %s 2>&1 | \
+// RUN: FileCheck --check-prefix=OMIT-ALL2 %s
+// OMIT-ALL2-NOT: "-mdisable-fp-elim"
+// OMIT-ALL2: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -S -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer %s 2>&1 | \
+// RUN: FileCheck --check-prefix=NO-OMIT-ALL2 %s
+// NO-OMIT-ALL2: "-mdisable-fp-elim"
+// NO-OMIT-ALL2-NOT: "-momit-leaf-frame-pointer"
+
void f0() {}
void f1() { f0(); }
Index: test/Driver/cl-options.c
===================================================================
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -171,11 +171,10 @@
// RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s
// PR24003: -mdisable-fp-elim
-// PR24003: -momit-leaf-frame-pointer
// PR24003: -Os
// RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s
-// Oy_2: -momit-leaf-frame-pointer
+// Oy_2: -mdisable-fp-elim
// Oy_2: -O2
// RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -498,7 +498,7 @@
return codegenoptions::LimitedDebugInfo;
}
-static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple &Triple) {
+static bool mustUseFramePointerForTarget(const llvm::Triple &Triple) {
switch (Triple.getArch()){
default:
return false;
@@ -575,7 +575,7 @@
if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
options::OPT_fomit_frame_pointer))
return A->getOption().matches(options::OPT_fno_omit_frame_pointer) ||
- mustUseNonLeafFramePointerForTarget(Triple);
+ mustUseFramePointerForTarget(Triple);
if (Args.hasArg(options::OPT_pg))
return true;
@@ -589,6 +589,11 @@
options::OPT_momit_leaf_frame_pointer))
return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
+ if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
+ options::OPT_fomit_frame_pointer))
+ return A->getOption().matches(options::OPT_fno_omit_frame_pointer) ||
+ mustUseFramePointerForTarget(Triple);
+
if (Args.hasArg(options::OPT_pg))
return true;
Index: lib/CodeGen/CGCall.cpp
===================================================================
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1736,7 +1736,6 @@
FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf");
} else {
FuncAttrs.addAttribute("no-frame-pointer-elim", "true");
- FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf");
}
FuncAttrs.addAttribute("less-precise-fpmad",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55915.179325.patch
Type: text/x-patch
Size: 3896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181221/ac965acf/attachment.bin>
More information about the cfe-commits
mailing list