diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2021-03-14 12:27:42 -0500 |
---|---|---|
committer | Johannes Doerfert <johannes@jdoerfert.de> | 2021-03-15 22:45:56 -0500 |
commit | f40a2c3befc81dd9bb18d216d441bd29b98e3e9a (patch) | |
tree | ea7d097ba730b76e932c20607616b65defc5228f /llvm/lib/Analysis/TargetLibraryInfo.cpp | |
parent | 5bb2757e218dfa06662e6f019c13c3378e36c925 (diff) | |
download | llvm-f40a2c3befc81dd9bb18d216d441bd29b98e3e9a.zip llvm-f40a2c3befc81dd9bb18d216d441bd29b98e3e9a.tar.gz llvm-f40a2c3befc81dd9bb18d216d441bd29b98e3e9a.tar.bz2 |
[NVPTX] CUDA does provide malloc/free since compute capability 2.X
https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#dynamic-global-memory-allocation-and-operations
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D98606
Diffstat (limited to 'llvm/lib/Analysis/TargetLibraryInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/TargetLibraryInfo.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp index 6b979d6..31cea8f 100644 --- a/llvm/lib/Analysis/TargetLibraryInfo.cpp +++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp @@ -547,6 +547,17 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, if (T.isNVPTX()) { TLI.disableAllFunctions(); TLI.setAvailable(LibFunc_nvvm_reflect); + TLI.setAvailable(llvm::LibFunc_malloc); + TLI.setAvailable(llvm::LibFunc_free); + + // TODO: We could enable the following two according to [0] but we haven't + // done an evaluation wrt. the performance implications. + // [0] + // https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#dynamic-global-memory-allocation-and-operations + // + // TLI.setAvailable(llvm::LibFunc_memcpy); + // TLI.setAvailable(llvm::LibFunc_memset); + } else { TLI.setUnavailable(LibFunc_nvvm_reflect); } |