[Attributor] Make sure Heap2Stack works properly on a GPU target
authorJohannes Doerfert <johannes@jdoerfert.de>
Thu, 17 Jun 2021 16:11:16 +0000 (11:11 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Fri, 18 Jun 2021 06:07:52 +0000 (01:07 -0500)
commit9959eee0015a97f3eb6bdb1b7b1f500190d66f53
treed34a003d601a3dda998f3d73d674d04fbfd30826
parent9a23e673caebdd54d8cc285fcad78f18fa2e919a
[Attributor] Make sure Heap2Stack works properly on a GPU target

If the target stack is not accessible between different running
"threads" we have to make sure not to create allocas for mallocs
that might be used by multiple "threads". The "use check" is
sufficient to prevent this but if we apply the "free check" we have
to make sure the pointer is not communicated to others before
the free is reached.

Differential Revision: https://reviews.llvm.org/D98608
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/depgraph.ll
llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll [new file with mode: 0644]