AMDGPU: Handle structs directly in AMDGPUABIInfo
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 22 Aug 2016 19:25:59 +0000 (19:25 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 22 Aug 2016 19:25:59 +0000 (19:25 +0000)
commit88d7da01ca7af18ed6bd446d388999bf9668a3cf
treeead8207c72d01e8f85aa009fcf809b39682a3619
parent3d512a2dc20aa43fc39c9bdea7067ff073ba7298
AMDGPU: Handle structs directly in AMDGPUABIInfo

Structs are currently handled as pointer + byval, which makes AMDGPU
LLVM backend generate incorrect code when structs are used. This patch
changes struct argument to be handled directly and without flattening,
which Clover (Mesa 3D Gallium OpenCL state tracker) will be able to
handle. Flattening would expand the struct to individual elements and
pass each as a separate argument, which Clover can not
handle. Furthermore, such expansion does not fit the OpenCL
programming model which requires to explicitely specify each argument
index, size and memory location.

Patch by Vedran Miletić

llvm-svn: 279463
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl [new file with mode: 0644]