mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-23 19:59:57 +00:00
AMDGPU: Change DivergenceAnalysis for function arguments
Stop assuming all functions are kernels. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300719 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d6b4b10a39
commit
610621c4ba
@ -426,16 +426,23 @@ static bool isArgPassedInSGPR(const Argument *A) {
|
||||
const Function *F = A->getParent();
|
||||
|
||||
// Arguments to compute shaders are never a source of divergence.
|
||||
if (!AMDGPU::isShader(F->getCallingConv()))
|
||||
CallingConv::ID CC = F->getCallingConv();
|
||||
switch (CC) {
|
||||
case CallingConv::AMDGPU_KERNEL:
|
||||
case CallingConv::SPIR_KERNEL:
|
||||
return true;
|
||||
|
||||
// For non-compute shaders, SGPR inputs are marked with either inreg or byval.
|
||||
if (F->getAttributes().hasParamAttribute(A->getArgNo(), Attribute::InReg) ||
|
||||
F->getAttributes().hasParamAttribute(A->getArgNo(), Attribute::ByVal))
|
||||
return true;
|
||||
|
||||
// Everything else is in VGPRs.
|
||||
return false;
|
||||
case CallingConv::AMDGPU_VS:
|
||||
case CallingConv::AMDGPU_GS:
|
||||
case CallingConv::AMDGPU_PS:
|
||||
case CallingConv::AMDGPU_CS:
|
||||
// For non-compute shaders, SGPR inputs are marked with either inreg or byval.
|
||||
// Everything else is in VGPRs.
|
||||
return F->getAttributes().hasParamAttribute(A->getArgNo(), Attribute::InReg) ||
|
||||
F->getAttributes().hasParamAttribute(A->getArgNo(), Attribute::ByVal);
|
||||
default:
|
||||
// TODO: Should calls support inreg for SGPR inputs?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -1,5 +1,6 @@
|
||||
; RUN: opt %s -mtriple amdgcn-- -analyze -divergence | FileCheck %s
|
||||
|
||||
; CHECK-LABEL: Printing analysis 'Divergence Analysis' for function 'test_amdgpu_ps':
|
||||
; CHECK: DIVERGENT:
|
||||
; CHECK-NOT: %arg0
|
||||
; CHECK-NOT: %arg1
|
||||
@ -9,7 +10,31 @@
|
||||
; CHECK: DIVERGENT: float %arg5
|
||||
; CHECK: DIVERGENT: i32 %arg6
|
||||
|
||||
define amdgpu_ps void @main([4 x <16 x i8>] addrspace(2)* byval %arg0, float inreg %arg1, i32 inreg %arg2, <2 x i32> %arg3, <3 x i32> %arg4, float %arg5, i32 %arg6) #0 {
|
||||
define amdgpu_ps void @test_amdgpu_ps([4 x <16 x i8>] addrspace(2)* byval %arg0, float inreg %arg1, i32 inreg %arg2, <2 x i32> %arg3, <3 x i32> %arg4, float %arg5, i32 %arg6) #0 {
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: Printing analysis 'Divergence Analysis' for function 'test_amdgpu_kernel':
|
||||
; CHECK-NOT: %arg0
|
||||
; CHECK-NOT: %arg1
|
||||
; CHECK-NOT: %arg2
|
||||
; CHECK-NOT: %arg3
|
||||
; CHECK-NOT: %arg4
|
||||
; CHECK-NOT: %arg5
|
||||
; CHECK-NOT: %arg6
|
||||
define amdgpu_kernel void @test_amdgpu_kernel([4 x <16 x i8>] addrspace(2)* byval %arg0, float inreg %arg1, i32 inreg %arg2, <2 x i32> %arg3, <3 x i32> %arg4, float %arg5, i32 %arg6) #0 {
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: Printing analysis 'Divergence Analysis' for function 'test_c':
|
||||
; CHECK: DIVERGENT:
|
||||
; CHECK: DIVERGENT:
|
||||
; CHECK: DIVERGENT:
|
||||
; CHECK: DIVERGENT:
|
||||
; CHECK: DIVERGENT:
|
||||
; CHECK: DIVERGENT:
|
||||
; CHECK: DIVERGENT:
|
||||
define void @test_c([4 x <16 x i8>] addrspace(2)* byval %arg0, float inreg %arg1, i32 inreg %arg2, <2 x i32> %arg3, <3 x i32> %arg4, float %arg5, i32 %arg6) #0 {
|
||||
ret void
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user