[clang] [Clang] [WIP] Added builtin_alloca right Address Space for OpenCL (PR #95750)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 19 03:56:38 PDT 2024


================
@@ -1981,6 +1981,23 @@ static bool OpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID, CallExpr *Call) {
   return false;
 }
 
+// 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) {
+  QualType RT = TheCall->getType();
+  if (!RT->isPointerType() || RT->getPointeeType().hasAddressSpace())
+    return true;
+
+  if (S.getLangOpts().OpenCL) {
----------------
arsenm wrote:

Instead could only conditionally call the function if S.getLangOpts().OpenCL

https://github.com/llvm/llvm-project/pull/95750


More information about the cfe-commits mailing list