Author: Fangrui Song Date: 2020-02-01T00:29:29-08:00 New Revision: 1acf129bcf9a1b51e301a9fef151254ec4c7ec43
URL: https://github.com/llvm/llvm-project/commit/1acf129bcf9a1b51e301a9fef151254ec4c7ec43 DIFF: https://github.com/llvm/llvm-project/commit/1acf129bcf9a1b51e301a9fef151254ec4c7ec43.diff LOG: [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 Added: Modified: clang/lib/Frontend/CompilerInvocation.cpp clang/test/CodeGen/x86_64-profiling-keep-fp.c Removed: ################################################################################ diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 335f8cd0e323..f3015d0f7085 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 a51d87fa6365..c22fafd74949 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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits