OSDN Git Service

[NVPTX] Improve lowering of byval args of device functions.
authorArtem Belevich <tra@google.com>
Tue, 21 Jun 2016 20:30:26 +0000 (20:30 +0000)
committerArtem Belevich <tra@google.com>
Tue, 21 Jun 2016 20:30:26 +0000 (20:30 +0000)
commita710d0d215c6a5a6752b0573a1901be38a6a1a63
tree995e1d4d1d63be63145717c57030f607ec4c1cb5
parent6e37dd76f66dcf057927a32b3c5b1977369359da
[NVPTX] Improve lowering of byval args of device functions.

Avoid unnecessary spills of such vars to local space on SASS level and
pointer space conversion.

Instead, make a local copy with appropriate addrspacecasts and let
LLVM optimize them away when possible.

This allows loading value of the argument using [symbol+offset]
instead of converting argument to general space pointer and using it
for indexing (which also implicitly converts param space pointer to
local space one on SASS level and triggers copying of argument into
local space in the process).

This reduces call overhead, uses less registers and reduces overall
SASS size by 2-4%.

Differential Review: http://reviews.llvm.org/D21421

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273313 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
lib/Target/NVPTX/NVPTXISelLowering.cpp
lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp
test/CodeGen/NVPTX/bug21465.ll
test/CodeGen/NVPTX/lower-kernel-ptr-arg.ll