Skip to content

Commit 14c323c

Browse files
[OpenMP][AMDGPU] Do not attach -fcuda-is-device (#99002)
-fcuda-is-device flag is not used for OpenMP offloading for AMD GPUs and it does not need to be added as clang cc1 option for OpenMP code. This PR has the same functionality as #96909 but it doesn't introduce regression for virtual function support.
1 parent 0ce3ea1 commit 14c323c

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

clang/lib/CodeGen/CodeGenModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ class CodeGenModule : public CodeGenTypeCache {
10101010
bool shouldEmitRTTI(bool ForEH = false) {
10111011
return (ForEH || getLangOpts().RTTI) && !getLangOpts().CUDAIsDevice &&
10121012
!(getLangOpts().OpenMP && getLangOpts().OpenMPIsTargetDevice &&
1013-
getTriple().isNVPTX());
1013+
(getTriple().isNVPTX() || getTriple().isAMDGPU()));
10141014
}
10151015

10161016
/// Get the address of the RTTI descriptor for the given type.

clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ void AMDGPUOpenMPToolChain::addClangTargetOptions(
4747
assert(DeviceOffloadingKind == Action::OFK_OpenMP &&
4848
"Only OpenMP offloading kinds are supported.");
4949

50-
CC1Args.push_back("-fcuda-is-device");
51-
5250
if (DriverArgs.hasArg(options::OPT_nogpulib))
5351
return;
5452

clang/test/Driver/amdgpu-openmp-toolchain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// verify the tools invocations
99
// CHECK: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-emit-llvm-bc"{{.*}}"-x" "c"
10-
// CHECK: "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}}"-fcuda-is-device"{{.*}}"-target-cpu" "gfx906"
10+
// CHECK: "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}}"-target-cpu" "gfx906"
1111
// CHECK: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-emit-obj"
1212
// CHECK: clang-linker-wrapper{{.*}} "-o" "a.out"
1313

0 commit comments

Comments
 (0)