[clang] ab244db - [AIX] Emitting diagnostics error for profile options
Whitney Tsang via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 23 17:23:36 PDT 2021
Author: Whitney Tsang
Date: 2021-06-24T00:23:28Z
New Revision: ab244db1fa0b72f3c0ac928158569fdcc6db0236
URL: https://github.com/llvm/llvm-project/commit/ab244db1fa0b72f3c0ac928158569fdcc6db0236
DIFF: https://github.com/llvm/llvm-project/commit/ab244db1fa0b72f3c0ac928158569fdcc6db0236.diff
LOG: [AIX] Emitting diagnostics error for profile options
Only LLVM-based instrumentation profile is supported on AIX.
And it currently must be used with full LTO.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D104803
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/unsupported-option.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 0d1fce3c06aea..29b15b516b9e5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -801,6 +801,20 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
PGOGenerateArg = nullptr;
}
+ 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) {
if (ProfileGenerateArg->getOption().matches(
options::OPT_fprofile_instr_generate_EQ))
diff --git a/clang/test/Driver/unsupported-option.c b/clang/test/Driver/unsupported-option.c
index d0611977a99e1..975440352259d 100644
--- a/clang/test/Driver/unsupported-option.c
+++ b/clang/test/Driver/unsupported-option.c
@@ -1,7 +1,23 @@
// 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 --target=powerpc-ibm-aix %s 2>&1 | \
+// RUN: FileCheck %s --check-prefix=INVALID-AIX-PROFILE
+// INVALID-AIX-PROFILE: error: unsupported option '-fprofile-instr-generate' for target
+
+// RUN: not %clang -fprofile-sample-use=code.prof --target=powerpc-ibm-aix %s 2>&1 | \
+// RUN: FileCheck %s --check-prefix=AIX-PROFILE-SAMPLE
+// AIX-PROFILE-SAMPLE: 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=powerpc64-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'
More information about the cfe-commits
mailing list