[Attributor][FIX] Avoid H2S on GPUs if the pointer can be shared
authorJohannes Doerfert <johannes@jdoerfert.de>
Tue, 21 Mar 2023 00:13:18 +0000 (17:13 -0700)
committerJohannes Doerfert <johannes@jdoerfert.de>
Tue, 21 Mar 2023 00:44:24 +0000 (17:44 -0700)
commitc0f3a3d7b50c6bec85b8c5eb8d821087499eec41
treee2de56f7f5a5d41fcb66223b80a4d28df742d0db
parent8f47fd05d53f60be40a52d09df9dedc970bbafc5
[Attributor][FIX] Avoid H2S on GPUs if the pointer can be shared

If the stack is not accessible by other threads, e.g., on a GPU, we need
to ensure heap-2-stack will not create a stack version of a pointer that
might be passed to another thread. Since passing through memory is by
default transparent, we need to register a callback and inspect stores
we might look through explicitly.
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/heap_to_stack.ll
llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll