diff options
| author | Artem Belevich <tra@google.com> | 2018-01-24 17:41:02 +0000 |
|---|---|---|
| committer | Artem Belevich <tra@google.com> | 2018-01-24 17:41:02 +0000 |
| commit | c30bcad19c748556aae2c5865850026aff546359 (patch) | |
| tree | bb0cf669e3901f934b685e566cc8bfedbe4ed52e /clang | |
| parent | fc16f76edbffb273459cc9b0bdef6b576d8f438e (diff) | |
| download | bcm5719-llvm-c30bcad19c748556aae2c5865850026aff546359.tar.gz bcm5719-llvm-c30bcad19c748556aae2c5865850026aff546359.zip | |
[CUDA] Disable PGO and coverage instrumentation in NVPTX.
NVPTX does not have runtime support necessary for profiling to work
and even call arc collection is prohibitively expensive. Furthermore,
there's no easy way to collect the samples. NVPTX also does not
support global constructors that clang generates if sample/arc collection
is enabled.
Differential Revision: https://reviews.llvm.org/D42452
llvm-svn: 323345
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 6 | ||||
| -rw-r--r-- | clang/test/Driver/cuda-no-pgo-or-coverage.cu | 34 |
2 files changed, 39 insertions, 1 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index f30782d8bf8..1741517bffb 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -3625,7 +3625,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_finstrument_function_entry_bare)) A->render(Args, CmdArgs); - addPGOAndCoverageFlags(C, D, Output, Args, CmdArgs); + // NVPTX doesn't support PGO or coverage. There's no runtime support for + // sampling, overhead of call arc collection is way too high and there's no + // way to collect the output. + if (!Triple.isNVPTX()) + addPGOAndCoverageFlags(C, D, Output, Args, CmdArgs); if (auto *ABICompatArg = Args.getLastArg(options::OPT_fclang_abi_compat_EQ)) ABICompatArg->render(Args, CmdArgs); diff --git a/clang/test/Driver/cuda-no-pgo-or-coverage.cu b/clang/test/Driver/cuda-no-pgo-or-coverage.cu new file mode 100644 index 00000000000..a2cb610f752 --- /dev/null +++ b/clang/test/Driver/cuda-no-pgo-or-coverage.cu @@ -0,0 +1,34 @@ +// Check that profiling/coverage arguments doen't get passed down to device-side +// compilation. +// +// REQUIRES: clang-driver +// +// XRUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ +// XRUN: -fprofile-generate %s 2>&1 | \ +// XRUN: FileCheck --check-prefixes=CHECK,PROF %s +// +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ +// RUN: -fprofile-instr-generate %s 2>&1 | \ +// RUN: FileCheck --check-prefixes=CHECK,PROF %s +// +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ +// RUN: -coverage %s 2>&1 | \ +// RUN: FileCheck --check-prefixes=CHECK,GCOV %s +// +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ +// RUN: -ftest-coverage %s 2>&1 | \ +// RUN: FileCheck --check-prefixes=CHECK,GCOV %s +// +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ +// RUN: -fprofile-instr-generate -fcoverage-mapping %s 2>&1 | \ +// RUN: FileCheck --check-prefixes=CHECK,PROF,GCOV %s +// +// +// CHECK-NOT: error: unsupported option '-fprofile +// CHECK-NOT: error: invalid argument +// CHECK-DAG: "-fcuda-is-device" +// CHECK-NOT: "-f{{[^"]*coverage.*}}" +// CHECK-NOT: "-fprofile{{[^"]*}}" +// CHECK: "-triple" "x86_64--linux-gnu" +// PROF-DAG: "-fprofile{{.*}}" +// GCOV-DAG: "-f{{(coverage|emit-coverage).*}}" |

