AMDGPU: Stop reporting is-noop addrspacecast for constant 32-bit

This will require something to cast. Before this would eliminate
the cast, which would result in copies of $noreg.

llvm-svn: 341803
This commit is contained in:
Matt Arsenault 2018-09-10 11:59:27 +00:00
parent 09f00dcf69
commit 7f6dc597d3
2 changed files with 8 additions and 2 deletions

View File

@ -1120,8 +1120,7 @@ EVT SITargetLowering::getOptimalMemOpType(uint64_t Size, unsigned DstAlign,
static bool isFlatGlobalAddrSpace(unsigned AS) {
return AS == AMDGPUAS::GLOBAL_ADDRESS ||
AS == AMDGPUAS::FLAT_ADDRESS ||
AS == AMDGPUAS::CONSTANT_ADDRESS ||
AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT;
AS == AMDGPUAS::CONSTANT_ADDRESS;
}
bool SITargetLowering::isNoopAddrSpaceCast(unsigned SrcAS,

View File

@ -6,3 +6,10 @@ define amdgpu_kernel void @use_group_to_global_addrspacecast(i32 addrspace(3)* %
store volatile i32 0, i32 addrspace(1)* %stof
ret void
}
; ERROR: error: <unknown>:0:0: in function use_constant32bit_to_flat_addrspacecast void (i32 addrspace(6)*): invalid addrspacecast
define amdgpu_kernel void @use_constant32bit_to_flat_addrspacecast(i32 addrspace(6)* %ptr) #0 {
%stof = addrspacecast i32 addrspace(6)* %ptr to i32*
store volatile i32 7, i32* %stof
ret void
}