File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -275,14 +275,15 @@ void AMDGPUTargetInfo::getTargetDefines(const LangOptions &Opts,
275
275
Builder.defineMacro (" __R600__" );
276
276
277
277
// Legacy HIP host code relies on these default attributes to be defined.
278
- if (GPUKind == llvm::AMDGPU::GK_NONE && !(Opts.HIP && !Opts.CUDAIsDevice ))
278
+ bool IsHIPHost = Opts.HIP && !Opts.CUDAIsDevice ;
279
+ if (GPUKind == llvm::AMDGPU::GK_NONE && !IsHIPHost)
279
280
return ;
280
281
281
282
StringRef CanonName = isAMDGCN (getTriple ()) ? getArchNameAMDGCN (GPUKind)
282
283
: getArchNameR600 (GPUKind);
283
284
Builder.defineMacro (Twine (" __" ) + Twine (CanonName) + Twine (" __" ));
284
285
// Emit macros for gfx family e.g. gfx906 -> __GFX9__, gfx1030 -> __GFX10___
285
- if (isAMDGCN (getTriple ()) && Opts. CUDAIsDevice ) {
286
+ if (isAMDGCN (getTriple ()) && !IsHIPHost ) {
286
287
assert (CanonName.starts_with (" gfx" ) && " Invalid amdgcn canonical name" );
287
288
Builder.defineMacro (Twine (" __" ) + Twine (CanonName.drop_back (2 ).upper ()) +
288
289
Twine (" __" ));
You can’t perform that action at this time.
0 commit comments