aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorAlex Voicu <alexandru.voicu@amd.com>2024-10-22 12:05:48 +0100
committerGitHub <noreply@github.com>2024-10-22 12:05:48 +0100
commit6e0b0038cd65ce726ce404305a06e1cf33e36cca (patch)
tree9c0bec00224779e65882ed977e71d5df527d767f /clang/lib/CodeGen/CGBlocks.cpp
parentaea60ab94db4729bad17daa86ccfc411d48a1699 (diff)
downloadllvm-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/CodeGen/CGBlocks.cpp')
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 684fda7..41bb8d1 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -1397,7 +1397,8 @@ void CodeGenFunction::setBlockContextParameter(const ImplicitParamDecl *D,
DI->setLocation(D->getLocation());
DI->EmitDeclareOfBlockLiteralArgVariable(
*BlockInfo, D->getName(), argNum,
- cast<llvm::AllocaInst>(alloc.getPointer()), Builder);
+ cast<llvm::AllocaInst>(alloc.getPointer()->stripPointerCasts()),
+ Builder);
}
}