AMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is at least 4-byte aligned

Summary: This fixes some OpenCV tests that were broken by libclc commit r276443.

Reviewers: arsenm, jvesely

Subscribers: arsenm, wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D24051

llvm-svn: 280274
This commit is contained in:
Tom Stellard 2016-08-31 18:46:07 +00:00
parent 1c06a73a7c
commit ba5730884b
2 changed files with 15 additions and 1 deletions

View File

@ -2683,7 +2683,7 @@ SDValue AMDGPUTargetLowering::CreateLiveInRegister(SelectionDAG &DAG,
uint32_t AMDGPUTargetLowering::getImplicitParameterOffset(
const AMDGPUMachineFunction *MFI, const ImplicitParameter Param) const {
uint64_t ArgOffset = MFI->getABIArgOffset();
uint64_t ArgOffset = alignTo(MFI->getABIArgOffset(), 4);
switch (Param) {
case GRID_DIM:
return ArgOffset;

View File

@ -27,6 +27,20 @@ define void @test_implicit(i32 addrspace(1)* %out) #1 {
ret void
}
; ALL-LABEL: {{^}}test_implicit_alignment
; MESA: s_load_dword [[VAL:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0xc
; HSA: s_load_dword [[VAL:s[0-9]+]], s[{{[0-9]+:[0-9]+}}], 0x3
; ALL: v_mov_b32_e32 [[V_VAL:v[0-9]+]], [[VAL]]
; MESA: buffer_store_dword [[V_VAL]]
; HSA: flat_store_dword v[{{[0-9]+:[0-9]+}}], [[V_VAL]]
define void @test_implicit_alignment(i32 addrspace(1)* %out, <2 x i8> %in) #1 {
%implicitarg.ptr = call noalias i8 addrspace(2)* @llvm.amdgcn.implicitarg.ptr()
%arg.ptr = bitcast i8 addrspace(2)* %implicitarg.ptr to i32 addrspace(2)*
%val = load i32, i32 addrspace(2)* %arg.ptr
store i32 %val, i32 addrspace(1)* %out
ret void
}
declare i8 addrspace(2)* @llvm.amdgcn.kernarg.segment.ptr() #0
declare i8 addrspace(2)* @llvm.amdgcn.implicitarg.ptr() #0