diff options
author | Alex Voicu <alexandru.voicu@amd.com> | 2024-10-22 12:05:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-22 12:05:48 +0100 |
commit | 6e0b0038cd65ce726ce404305a06e1cf33e36cca (patch) | |
tree | 9c0bec00224779e65882ed977e71d5df527d767f /clang/lib/Basic/Targets/AMDGPU.cpp | |
parent | aea60ab94db4729bad17daa86ccfc411d48a1699 (diff) | |
download | llvm-6e0b0038cd65ce726ce404305a06e1cf33e36cca.zip llvm-6e0b0038cd65ce726ce404305a06e1cf33e36cca.tar.gz llvm-6e0b0038cd65ce726ce404305a06e1cf33e36cca.tar.bz2 |
[clang][OpenCL][CodeGen][AMDGPU] Do not use `private` as the default AS for when `generic` is available (#112442)
Currently, for AMDGPU, when compiling for OpenCL, we unconditionally use
`private` as the default address space. This is wrong for cases where
the `generic` address space is available, and is corrected via this
patch. In general, this AS map abuse is a bad hack and we should re-work
it altogether, but at least after this patch we will stop being
incorrect for e.g. OpenCL 2.0.
Diffstat (limited to 'clang/lib/Basic/Targets/AMDGPU.cpp')
-rw-r--r-- | clang/lib/Basic/Targets/AMDGPU.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Basic/Targets/AMDGPU.cpp b/clang/lib/Basic/Targets/AMDGPU.cpp index 3b748d0..0788191 100644 --- a/clang/lib/Basic/Targets/AMDGPU.cpp +++ b/clang/lib/Basic/Targets/AMDGPU.cpp @@ -260,9 +260,9 @@ AMDGPUTargetInfo::AMDGPUTargetInfo(const llvm::Triple &Triple, void AMDGPUTargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) { TargetInfo::adjust(Diags, Opts); // ToDo: There are still a few places using default address space as private - // address space in OpenCL, which needs to be cleaned up, then Opts.OpenCL - // can be removed from the following line. - setAddressSpaceMap(/*DefaultIsPrivate=*/Opts.OpenCL || + // address space in OpenCL, which needs to be cleaned up, then the references + // to OpenCL can be removed from the following line. + setAddressSpaceMap((Opts.OpenCL && !Opts.OpenCLGenericAddressSpace) || !isAMDGCN(getTriple())); } |