]> granicus.if.org Git - llvm/commit
AMDGPU: Add pass to replace out arguments
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 28 Jul 2017 18:40:05 +0000 (18:40 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 28 Jul 2017 18:40:05 +0000 (18:40 +0000)
commitacac0ef9e7969b382e4180a75cd188b86fe83c8f
tree668df7c929ce11630b58e3db5f09a2a015278c29
parent5398f502a225f8a0e40b39cc108f4f26583098fd
AMDGPU: Add pass to replace out arguments

It is better to return arguments directly in registers
if we are making a call rather than introducing expensive
stack usage. In one of sample compile from one of
Blender's many kernel variants, this fires on about
~20 different functions. Future improvements may be to
recognize simple cases where the pointer is indexing a small
array. This also fails when the store to the out argument
is in a separate block from the return, which happens in
a few of the Blender functions. This should also probably
be using MemorySSA which might help with that.

I'm not sure this is correct as a FunctionPass, but
MemoryDependenceAnalysis seems to not work with
a ModulePass.

I'm also not sure where it should run.I think it should
run  before DeadArgumentElimination, so maybe either
EP_CGSCCOptimizerLate or EP_ScalarOptimizerLate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309416 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/AMDGPU.h
lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp [new file with mode: 0644]
lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
lib/Target/AMDGPU/CMakeLists.txt
test/CodeGen/AMDGPU/rewrite-out-arguments-address-space.ll [new file with mode: 0644]
test/CodeGen/AMDGPU/rewrite-out-arguments.ll [new file with mode: 0644]