Skip to content

Commit 23058f9

Browse files
committed
[OPENMP]Do not use RTTI by default for NVPTX devices.
NVPTX does not support RTTI, so disable it by default.
1 parent 20c6e07 commit 23058f9

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ static ToolChain::RTTIMode CalculateRTTIMode(const ArgList &Args,
6868
}
6969

7070
// -frtti is default, except for the PS4 CPU.
71-
return (Triple.isPS4CPU()) ? ToolChain::RM_Disabled : ToolChain::RM_Enabled;
71+
return (Triple.isPS4CPU() || Triple.isNVPTX()) ? ToolChain::RM_Disabled
72+
: ToolChain::RM_Enabled;
7273
}
7374

7475
ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
///
2+
/// Perform several driver tests for OpenMP offloading
3+
///
4+
5+
// REQUIRES: clang-driver
6+
// REQUIRES: x86-registered-target
7+
// REQUIRES: powerpc-registered-target
8+
// REQUIRES: nvptx-registered-target
9+
10+
/// ###########################################################################
11+
12+
/// PTXAS is passed -c flag by default when offloading to an NVIDIA device using OpenMP
13+
/// Check that the flag is passed when -fopenmp-relocatable-target is used.
14+
// RUN: %clangxx -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda \
15+
// RUN: -save-temps -no-canonical-prefixes %s -x c++ -c 2>&1 \
16+
// RUN: | FileCheck -check-prefix=CHK-RTTI %s
17+
18+
// CHK-RTTI: clang{{.*}}" "-triple" "nvptx64-nvidia-cuda"
19+
// CHK-RTTI-SAME: "-fno-rtti"
20+

0 commit comments

Comments
 (0)