[clang] [Clang] [WIP] Added builtin_alloca right Address Space for OpenCL (PR #95750)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 04:04:25 PDT 2024
================
@@ -1983,17 +1983,14 @@ static bool OpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID, CallExpr *Call) {
// In OpenCL, __builtin_alloca_* should return a pointer to address space
// that corresponds to the stack address space i.e private address space.
-static bool OpenCLBuiltinAllocaAddrSpace(Sema &S, CallExpr *TheCall) {
+static bool builtinAllocaAddrSpace(Sema &S, CallExpr *TheCall) {
QualType RT = TheCall->getType();
- if (!RT->isPointerType() || RT->getPointeeType().hasAddressSpace())
- return true;
-
- if (S.getLangOpts().OpenCL) {
- RT = RT->getPointeeType();
+ assert((RT->isPointerType() && !(RT->getPointeeType().hasAddressSpace())) &&
+ "__builtin_alloca has invalid address space");
- RT = S.Context.getAddrSpaceQualType(RT, LangAS::opencl_private);
- TheCall->setType(S.Context.getPointerType(RT));
- }
+ RT = RT->getPointeeType();
+ RT = S.Context.getAddrSpaceQualType(RT, LangAS::opencl_private);
+ TheCall->setType(S.Context.getPointerType(RT));
return false;
----------------
arsenm wrote:
return value is unused
https://github.com/llvm/llvm-project/pull/95750
More information about the cfe-commits
mailing list