summaryrefslogtreecommitdiff
path: root/test/Driver
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-12-12 14:52:27 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-12-12 14:52:27 +0000
commit55b58df36e758826d6b27598ca37c211b8fecf8a (patch)
treef6d13b11cb61dd9088f7deae8679dc9b4d5ab968 /test/Driver
parentd31b70f32c8649a0b914010b523a0430fe0cce0a (diff)
downloadclang-55b58df36e758826d6b27598ca37c211b8fecf8a.tar.gz
[CUDA][OPENMP][NVPTX]Improve logic of the debug info support.
Summary: Added support for the -gline-directives-only option + fixed logic of the debug info for CUDA devices. If optimization level is O0, then options --[no-]cuda-noopt-device-debug do not affect the debug info level. If the optimization level is >O0, debug info options are used + --no-cuda-noopt-device-debug is used or no --cuda-noopt-device-debug is used, the optimization level for the device code is kept and the emission of the debug directives is used. If the opt level is > O0, debug info is requested + --cuda-noopt-device-debug option is used, the optimization is disabled for the device code + required debug info is emitted. Reviewers: tra, echristo Subscribers: aprantl, guansong, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D51554 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Driver')
-rw-r--r--test/Driver/cuda-dwarf-2.cu30
-rw-r--r--test/Driver/openmp-offload-gpu.c31
2 files changed, 41 insertions, 20 deletions
diff --git a/test/Driver/cuda-dwarf-2.cu b/test/Driver/cuda-dwarf-2.cu
index 7956e6ddbe..bcfb2444bc 100644
--- a/test/Driver/cuda-dwarf-2.cu
+++ b/test/Driver/cuda-dwarf-2.cu
@@ -1,25 +1,28 @@
// REQUIRES: clang-driver
//
-// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 | \
-// RUN: FileCheck %s -check-prefix NO_DEBUG
+// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 | \
+// RUN: FileCheck %s -check-prefix DEBUG_DIRECTIVES
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 2>&1 | \
-// RUN: FileCheck %s -check-prefix NO_DEBUG
+// RUN: FileCheck %s -check-prefix DEBUG_DIRECTIVES
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 --no-cuda-noopt-device-debug 2>&1 | \
-// RUN: FileCheck %s -check-prefix NO_DEBUG
+// RUN: FileCheck %s -check-prefix DEBUG_DIRECTIVES
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g0 2>&1 | \
// RUN: FileCheck %s -check-prefix NO_DEBUG
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb0 -O3 --cuda-noopt-device-debug 2>&1 | \
// RUN: FileCheck %s -check-prefix NO_DEBUG
-// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb1 2>&1 | \
-// RUN: FileCheck %s -check-prefix NO_DEBUG -check-prefix LINE_TABLE
-// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-tables-only -O2 --cuda-noopt-device-debug 2>&1 | \
-// RUN: FileCheck %s -check-prefix NO_DEBUG -check-prefix LINE_TABLE
+// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-directives-only -O2 --cuda-noopt-device-debug 2>&1 | \
+// RUN: FileCheck %s -check-prefix DEBUG_DIRECTIVES
// NO_DEBUG-NOT: warning: debug
-// LINE_TABLE-NOT: warning: debug
+// DEBUG_DIRECTIVES-NOT: warning: debug
+// NO_DEBUG: "-fcuda-is-device"
+// NO_DEBUG-NOT: "-debug-info-kind=
// NO_DEBUG: ptxas
// NO_DEBUG-NOT: "-g"
-// LINE_TABLE: "-lineinfo"
+// DEBUG_DIRECTIVES: "-fcuda-is-device"
+// DEBUG_DIRECTIVES-SAME: "-debug-info-kind=line-directives-only"
+// DEBUG_DIRECTIVES: ptxas
+// DEBUG_DIRECTIVES-SAME: "-lineinfo"
// NO_DEBUG: fatbinary
// NO_DEBUG-NOT: "-g"
@@ -27,6 +30,8 @@
// RUN: FileCheck %s -check-prefix HAS_DEBUG
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O0 --cuda-noopt-device-debug 2>&1 | \
// RUN: FileCheck %s -check-prefix HAS_DEBUG
+// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 | \
+// RUN: FileCheck %s -check-prefix HAS_DEBUG
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 --cuda-noopt-device-debug 2>&1 | \
// RUN: FileCheck %s -check-prefix HAS_DEBUG
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g2 2>&1 | \
@@ -37,9 +42,14 @@
// RUN: FileCheck %s -check-prefix HAS_DEBUG
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb3 -O3 --cuda-noopt-device-debug 2>&1 | \
// RUN: FileCheck %s -check-prefix HAS_DEBUG
+// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb1 2>&1 | \
+// RUN: FileCheck %s -check-prefix HAS_DEBUG
+// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-tables-only -O2 --cuda-noopt-device-debug 2>&1 | \
+// RUN: FileCheck %s -check-prefix HAS_DEBUG
// HAS_DEBUG-NOT: warning: debug
// HAS_DEBUG: "-fcuda-is-device"
+// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}"
// HAS_DEBUG-SAME: "-dwarf-version=2"
// HAS_DEBUG: ptxas
// HAS_DEBUG-SAME: "-g"
diff --git a/test/Driver/openmp-offload-gpu.c b/test/Driver/openmp-offload-gpu.c
index 940828b82b..dfdc79b5f7 100644
--- a/test/Driver/openmp-offload-gpu.c
+++ b/test/Driver/openmp-offload-gpu.c
@@ -190,29 +190,35 @@
// CHK-BCLIB-WARN: No library 'libomptarget-nvptx-sm_20.bc' found in the default clang lib directory or in LIBRARY_PATH. Expect degraded performance due to no inlining of runtime functions on target devices.
/// Check that debug info is emitted in dwarf-2
-// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 \
-// RUN: | FileCheck -check-prefix=NO_DEBUG %s
+// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 \
+// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 2>&1 \
-// RUN: | FileCheck -check-prefix=NO_DEBUG %s
+// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 --no-cuda-noopt-device-debug 2>&1 \
-// RUN: | FileCheck -check-prefix=NO_DEBUG %s
+// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g0 2>&1 \
// RUN: | FileCheck -check-prefix=NO_DEBUG %s
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb0 -O3 --cuda-noopt-device-debug 2>&1 \
// RUN: | FileCheck -check-prefix=NO_DEBUG %s
-// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-tables-only 2>&1 \
-// RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s
-// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \
-// RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s
+// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-directives-only 2>&1 \
+// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s
-// LINE_TABLE-NOT: warning: debug
+// DEBUG_DIRECTIVES-NOT: warning: debug
// NO_DEBUG-NOT: warning: debug
+// NO_DEBUG: "-fopenmp-is-device"
+// NO_DEBUG-NOT: "-debug-info-kind=
// NO_DEBUG: ptxas
-// LINE_TABLE: "-lineinfo"
+// DEBUG_DIRECTIVES: "-triple" "nvptx64-nvidia-cuda"
+// DEBUG_DIRECTIVES-SAME: "-debug-info-kind=line-directives-only"
+// DEBUG_DIRECTIVES-SAME: "-fopenmp-is-device"
+// DEBUG_DIRECTIVES: ptxas
+// DEBUG_DIRECTIVES: "-lineinfo"
// NO_DEBUG-NOT: "-g"
// NO_DEBUG: nvlink
// NO_DEBUG-NOT: "-g"
+// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 \
+// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g 2>&1 \
// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --cuda-noopt-device-debug 2>&1 \
@@ -227,9 +233,14 @@
// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb3 -O2 --cuda-noopt-device-debug 2>&1 \
// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
+// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-tables-only 2>&1 \
+// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
+// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \
+// RUN: | FileCheck -check-prefix=HAS_DEBUG %s
// HAS_DEBUG-NOT: warning: debug
// HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda"
+// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}"
// HAS_DEBUG-SAME: "-dwarf-version=2"
// HAS_DEBUG-SAME: "-fopenmp-is-device"
// HAS_DEBUG: ptxas