Skip to content

Commit

Permalink
[Frontend] Delete a redundant check of -pg for setFramePointer()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
MaskRay committed Feb 1, 2020
1 parent 2637769 commit 1acf129
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CodeGen/x86_64-profiling-keep-fp.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 1acf129

Please sign in to comment.