Index: lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp =================================================================== --- lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp +++ lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp @@ -54,8 +54,8 @@ static const AliasResult ASAliasRulesPrivIsZero[6][6] = { /* Private Global Constant Group Flat Region*/ /* Private */ {MayAlias, NoAlias , NoAlias , NoAlias , MayAlias, NoAlias}, - /* Global */ {NoAlias , MayAlias, NoAlias , NoAlias , MayAlias, NoAlias}, - /* Constant */ {NoAlias , NoAlias , MayAlias, NoAlias , MayAlias, NoAlias}, + /* Global */ {NoAlias , MayAlias, MayAlias, NoAlias , MayAlias, NoAlias}, + /* Constant */ {NoAlias , MayAlias, MayAlias, NoAlias , MayAlias, NoAlias}, /* Group */ {NoAlias , NoAlias , NoAlias , MayAlias, MayAlias, NoAlias}, /* Flat */ {MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias}, /* Region */ {NoAlias , NoAlias , NoAlias , NoAlias , MayAlias, MayAlias} @@ -63,10 +63,10 @@ static const AliasResult ASAliasRulesGenIsZero[6][6] = { /* Flat Global Region Group Constant Private */ /* Flat */ {MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias}, - /* Global */ {MayAlias, MayAlias, NoAlias , NoAlias , NoAlias , NoAlias}, - /* Constant */ {MayAlias, NoAlias , MayAlias, NoAlias , NoAlias, NoAlias}, - /* Group */ {MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , NoAlias}, + /* Global */ {MayAlias, MayAlias, NoAlias , NoAlias , MayAlias, NoAlias}, /* Region */ {MayAlias, NoAlias , NoAlias , NoAlias, MayAlias, NoAlias}, + /* Group */ {MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , NoAlias}, + /* Constant */ {MayAlias, MayAlias, MayAlias, NoAlias , NoAlias, NoAlias}, /* Private */ {MayAlias, NoAlias , NoAlias , NoAlias , NoAlias , MayAlias} }; static_assert(AMDGPUAS::MAX_COMMON_ADDRESS <= 6, "Addr space out of range"); Index: test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll =================================================================== --- test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll +++ test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll @@ -13,3 +13,15 @@ ret void } +; CHECK: MayAlias: i8 addrspace(1)* %p1, i8 addrspace(4)* %p + +define void @test_constant_vs_global(i8 addrspace(4)* %p, i8 addrspace(1)* %p1) { + ret void +} + +; CHECK: MayAlias: i8 addrspace(1)* %p, i8 addrspace(4)* %p1 + +define void @test_global_vs_constant(i8 addrspace(1)* %p, i8 addrspace(4)* %p1) { + ret void +} +