nickdesaulniers updated this revision to Diff 244916. nickdesaulniers added a comment.
- add test line Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74698/new/ https://reviews.llvm.org/D74698 Files: clang/lib/Driver/ToolChains/Clang.cpp clang/test/CodeGen/fentry.c Index: clang/test/CodeGen/fentry.c =================================================================== --- clang/test/CodeGen/fentry.c +++ clang/test/CodeGen/fentry.c @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -pg -mfentry -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -mfentry -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=NOPG %s // RUN: %clang_cc1 -mfentry -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=NOPG %s +// RUN: %clang_cc1 -pg -mfentry -emit-llvm -o - %s | FileCheck -check-prefix=NOFP %s int foo(void) { return 0; @@ -16,3 +17,5 @@ //CHECK-NOT: attributes #1 = { {{.*}}"fentry-call"="true"{{.*}} } //NOPG-NOT: attributes #0 = { {{.*}}"fentry-call"{{.*}} } //NOPG-NOT: attributes #1 = { {{.*}}"fentry-call"{{.*}} } +//NOFP-NOT: "frame-pointer"="all" +//NOFP: "frame-pointer"="none" Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -526,7 +526,7 @@ static bool useFramePointerForTargetByDefault(const ArgList &Args, const llvm::Triple &Triple) { - if (Args.hasArg(options::OPT_pg)) + if (Args.hasArg(options::OPT_pg) && !Args.hasArg(options::OPT_mfentry)) return true; switch (Triple.getArch()) { @@ -6150,7 +6150,8 @@ } if (Arg *A = Args.getLastArg(options::OPT_pg)) - if (FPKeepKind == CodeGenOptions::FramePointerKind::None) + if (FPKeepKind == CodeGenOptions::FramePointerKind::None && + !Args.hasArg(options::OPT_mfentry)) D.Diag(diag::err_drv_argument_not_allowed_with) << "-fomit-frame-pointer" << A->getAsString(Args);
Index: clang/test/CodeGen/fentry.c =================================================================== --- clang/test/CodeGen/fentry.c +++ clang/test/CodeGen/fentry.c @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -pg -mfentry -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -mfentry -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=NOPG %s // RUN: %clang_cc1 -mfentry -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=NOPG %s +// RUN: %clang_cc1 -pg -mfentry -emit-llvm -o - %s | FileCheck -check-prefix=NOFP %s int foo(void) { return 0; @@ -16,3 +17,5 @@ //CHECK-NOT: attributes #1 = { {{.*}}"fentry-call"="true"{{.*}} } //NOPG-NOT: attributes #0 = { {{.*}}"fentry-call"{{.*}} } //NOPG-NOT: attributes #1 = { {{.*}}"fentry-call"{{.*}} } +//NOFP-NOT: "frame-pointer"="all" +//NOFP: "frame-pointer"="none" Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -526,7 +526,7 @@ static bool useFramePointerForTargetByDefault(const ArgList &Args, const llvm::Triple &Triple) { - if (Args.hasArg(options::OPT_pg)) + if (Args.hasArg(options::OPT_pg) && !Args.hasArg(options::OPT_mfentry)) return true; switch (Triple.getArch()) { @@ -6150,7 +6150,8 @@ } if (Arg *A = Args.getLastArg(options::OPT_pg)) - if (FPKeepKind == CodeGenOptions::FramePointerKind::None) + if (FPKeepKind == CodeGenOptions::FramePointerKind::None && + !Args.hasArg(options::OPT_mfentry)) D.Diag(diag::err_drv_argument_not_allowed_with) << "-fomit-frame-pointer" << A->getAsString(Args);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits