[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
This commit is contained in:
Fangrui Song 2020-02-01 00:16:19 -08:00
parent 2637769b9f
commit 1acf129bcf
2 changed files with 1 additions and 6 deletions

View File

@ -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);

View File

@ -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