[PATCH] D104803: [AIX] Emitting diagnostics error for profile options
Whitney Tsang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 23 11:26:15 PDT 2021
Whitney created this revision.
Whitney added reviewers: hubert.reinterpretcast, etiotto, bmahjour, kbarton, daltenty.
Whitney added a project: LLVM.
Whitney requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Only LLVM-based instrumentation profile is supported on AIX.
And it currently must be used with full LTO.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104803
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/unsupported-option.c
Index: clang/test/Driver/unsupported-option.c
===================================================================
--- clang/test/Driver/unsupported-option.c
+++ clang/test/Driver/unsupported-option.c
@@ -1,7 +1,20 @@
// RUN: not %clang %s --hedonism -### 2>&1 | \
// RUN: FileCheck %s
+// CHECK: error: unsupported option '--hedonism'
+
// RUN: not %clang %s --hell -### 2>&1 | \
// RUN: FileCheck %s --check-prefix=DID-YOU-MEAN
-
-// CHECK: error: unsupported option '--hedonism'
// DID-YOU-MEAN: error: unsupported option '--hell'; did you mean '--help'?
+
+// RUN: not %clang -fprofile-instr-generate -fprofile-sample-use=code.prof --target=powerpc-ibm-aix %s 2>&1 | \
+// RUN: FileCheck %s --check-prefix=INVALID-AIX-PROFILE
+// INVALID-AIX-PROFILE-DAG: error: unsupported option '-fprofile-instr-generate' for target
+// INVALID-AIX-PROFILE-DAG: error: unsupported option '-fprofile-sample-use=' for target
+
+// RUN: not %clang -fprofile-generate --target=powerpc-ibm-aix %s 2>&1 | \
+// RUN: FileCheck %s --check-prefix=AIX-PROFILE-LTO
+// AIX-PROFILE-LTO: error: invalid argument '-fprofile-generate' only allowed with '-flto'
+
+// RUN: not %clang -fprofile-generate -flto=thin --target=powerpc-ibm-aix %s 2>&1 | \
+// RUN: FileCheck %s --check-prefix=AIX-PROFILE-THINLTO
+// AIX-PROFILE-THINLTO: error: invalid argument '-fprofile-generate' only allowed with '-flto'
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -776,6 +776,21 @@
options::OPT_fprofile_instr_generate,
options::OPT_fprofile_instr_generate_EQ,
options::OPT_fno_profile_instr_generate);
+
+ if (TC.getTriple().isOSAIX()) {
+ if (PGOGenerateArg)
+ if (!D.isUsingLTO(false /*IsDeviceOffloadAction */) ||
+ D.getLTOMode() != LTOK_Full)
+ D.Diag(clang::diag::err_drv_argument_only_allowed_with)
+ << PGOGenerateArg->getSpelling() << "-flto";
+ if (ProfileGenerateArg)
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << ProfileGenerateArg->getSpelling() << TC.getTriple().str();
+ if (Arg *ProfileSampleUseArg = getLastProfileSampleUseArg(Args))
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << ProfileSampleUseArg->getSpelling() << TC.getTriple().str();
+ }
+
if (ProfileGenerateArg &&
ProfileGenerateArg->getOption().matches(
options::OPT_fno_profile_instr_generate))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104803.354034.patch
Type: text/x-patch
Size: 2525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210623/ca0faf1a/attachment.bin>
More information about the cfe-commits
mailing list