aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2020-02-01 00:16:19 -0800
committerFangrui Song <maskray@google.com>2020-02-01 00:29:29 -0800
commit1acf129bcf9a1b51e301a9fef151254ec4c7ec43 (patch)
tree19519ed9937fd79d8205afead42bd74cc621a05c
parent2637769b9f38010082276b7b839a17b102d1ac93 (diff)
downloadllvm-1acf129bcf9a1b51e301a9fef151254ec4c7ec43.zip
llvm-1acf129bcf9a1b51e301a9fef151254ec4c7ec43.tar.gz
llvm-1acf129bcf9a1b51e301a9fef151254ec4c7ec43.tar.bz2
[Frontend] Delete a redundant check of -pg for setFramePointer()
Driver errors if -fomit-frame-pointer is used together with -pg. useFramePointerForTargetByDefault() returns true if -pg is specified. => (!OmitFP && useFramePointerForTargetByDefault(Args, Triple)) is true => We cannot get FramePointerKind::None
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp5
-rw-r--r--clang/test/CodeGen/x86_64-profiling-keep-fp.c2
2 files changed, 1 insertions, 6 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 335f8cd..f3015d0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -896,11 +896,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.setFramePointer(FP);
}
- // -pg may override -mframe-pointer
- // TODO: This should be merged into getFramePointerKind in Clang.cpp.
- if (Args.hasArg(OPT_pg))
- Opts.setFramePointer(CodeGenOptions::FramePointerKind::All);
-
Opts.DisableFree = Args.hasArg(OPT_disable_free);
Opts.DiscardValueNames = Args.hasArg(OPT_discard_value_names);
Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
diff --git a/clang/test/CodeGen/x86_64-profiling-keep-fp.c b/clang/test/CodeGen/x86_64-profiling-keep-fp.c
index a51d87f..c22fafd 100644
--- a/clang/test/CodeGen/x86_64-profiling-keep-fp.c
+++ b/clang/test/CodeGen/x86_64-profiling-keep-fp.c
@@ -1,5 +1,5 @@
// REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -mframe-pointer=non-leaf -pg -S -o - %s | \
// RUN: FileCheck %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -mframe-pointer=all -pg -S -o - %s | \
// RUN: FileCheck %s