Add NVPTXLowerAlloca pass to convert alloca'ed memory to local address
authorJingyue Wu <jingyue@google.com>
Wed, 17 Jun 2015 22:31:02 +0000 (22:31 +0000)
committerJingyue Wu <jingyue@google.com>
Wed, 17 Jun 2015 22:31:02 +0000 (22:31 +0000)
commitee36276e53d43c487d0f9869920da219e59a87ff
tree29f8831932a49412db200a04f3aafa3938c6a44a
parentc821cef8828c2491dec7ee6e1b6cc11c084ad45e
Add NVPTXLowerAlloca pass to convert alloca'ed memory to local address

Summary:
This is done by first adding two additional instructions to convert the
alloca returned address to local and convert it back to generic. Then
replace all uses of alloca instruction with the converted generic
address. Then we can rely NVPTXFavorNonGenericAddrSpace pass to combine
the generic addresscast and the corresponding Load, Store, Bitcast, GEP
Instruction together.

Patched by Xuetian Weng (xweng@google.com).

Test Plan: test/CodeGen/NVPTX/lower-alloca.ll

Reviewers: jholewinski, jingyue

Reviewed By: jingyue

Subscribers: meheff, broune, eliben, jholewinski, llvm-commits

Differential Revision: http://reviews.llvm.org/D10483

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239964 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/CMakeLists.txt
lib/Target/NVPTX/NVPTX.h
lib/Target/NVPTX/NVPTXLowerAlloca.cpp [new file with mode: 0644]
lib/Target/NVPTX/NVPTXTargetMachine.cpp
test/CodeGen/NVPTX/call-with-alloca-buffer.ll
test/CodeGen/NVPTX/lower-alloca.ll [new file with mode: 0644]