[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 16:36:19 PDT 2021
Whitney updated this revision to Diff 354108.
Whitney added a comment.
move code later
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104803/new/
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,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'
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -801,6 +801,20 @@
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))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104803.354108.patch
Type: text/x-patch
Size: 2530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210623/913e88de/attachment-0001.bin>
More information about the cfe-commits
mailing list