1 Commits

Author SHA1 Message Date
Alex Voicu
51a014cb2d [Clang][CodeGen] __builtin_allocas should care about address spaces
`alloca` instructions always return pointers to the `alloca` address space. This composes poorly with most HLLs which are address space agnostic and thus have all pointers point to generic/default. Static `alloca`s were already handled on the AST level, however dynamic `alloca`s were not, which would lead to subtly incorrect IR. This patch addresses that by inserting an address space cast iff the `alloca` address space is different from the default / expected.

Reviewed By: rjmccall, arsenm

Differential Revision: https://reviews.llvm.org/D156539
2023-08-01 21:55:36 +01:00