Skip to content

Commit 55c1aa7

Browse files
committed
[AA] Make alias check more accurately.
It should be considered to be aliased only if there is at lease one AA return non-NoAlias. The AliasResult affect the ChainDependency adding in ScheduleDAGInstrs, if a aliased memory location accessed in different type, TBAA may return NoAlias of them. This would result in incorrect instr order in final cg.
1 parent c8f37bb commit 55c1aa7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/lib/Analysis/AliasAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ AliasResult AAResults::alias(const MemoryLocation &LocA,
122122
AAQI.Depth++;
123123
for (const auto &AA : AAs) {
124124
Result = AA->alias(LocA, LocB, AAQI, CtxI);
125-
if (Result != AliasResult::MayAlias)
125+
if (Result != AliasResult::NoAlias)
126126
break;
127127
}
128128
AAQI.Depth--;

llvm/test/CodeGen/AMDGPU/tbaa-load-store.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ define amdgpu_kernel void @Kernel_func(i8 %a, i32 %b, i32 %c, i32 %end_bit) {
3030
; GCN-NEXT: v_min_i32_e32 v4, 1, v4
3131
; GCN-NEXT: v_bfe_u32 v3, v3, 0, v4
3232
; GCN-NEXT: v_lshlrev_b32_e32 v3, 1, v3
33+
; GCN-NEXT: ds_write_b32 v1, v0
3334
; GCN-NEXT: v_sub_u32_e32 v4, v2, v3
3435
; GCN-NEXT: ds_read_u16 v3, v4
35-
; GCN-NEXT: ds_write_b32 v1, v0
36-
; GCN-NEXT: s_waitcnt lgkmcnt(1)
36+
; GCN-NEXT: s_waitcnt lgkmcnt(0)
3737
; GCN-NEXT: v_add_u16_e32 v3, 1, v3
3838
; GCN-NEXT: v_cmp_ge_i32_e32 vcc, s1, v3
3939
; GCN-NEXT: s_or_b64 s[2:3], vcc, s[2:3]

0 commit comments

Comments
 (0)