Skip to content

Commit 6e52e53

Browse files
authored
[LAA] Test different-type-sizes in safe-dep-dist (#161244)
The isSafeDependenceDistance routine is guarded by a HasSameSize check which can be removed, as the test demonstrates.
1 parent bf847a8 commit 6e52e53

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

llvm/test/Analysis/LoopAccessAnalysis/depend_diff_types.ll

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,3 +560,44 @@ loop:
560560
exit:
561561
ret void
562562
}
563+
564+
; TODO: Relax HasSameSize check in isSafeDependenceDistance.
565+
define void @different_type_sizes_safe_dep_dist(i16 %n, ptr %p) {
566+
; CHECK-LABEL: 'different_type_sizes_safe_dep_dist'
567+
; CHECK-NEXT: loop:
568+
; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
569+
; CHECK-NEXT: Unknown data dependence.
570+
; CHECK-NEXT: Dependences:
571+
; CHECK-NEXT: Unknown:
572+
; CHECK-NEXT: store i32 0, ptr %gep.iv, align 1 ->
573+
; CHECK-NEXT: store i16 1, ptr %gep.off.iv, align 1
574+
; CHECK-EMPTY:
575+
; CHECK-NEXT: Run-time memory checks:
576+
; CHECK-NEXT: Grouped accesses:
577+
; CHECK-EMPTY:
578+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
579+
; CHECK-NEXT: SCEV assumptions:
580+
; CHECK-EMPTY:
581+
; CHECK-NEXT: Expressions re-written:
582+
;
583+
entry:
584+
%n.pos = icmp sgt i16 %n, 0
585+
br i1 %n.pos, label %ph, label %exit
586+
587+
ph:
588+
%gep.off = getelementptr i32, ptr %p, i16 %n
589+
br label %loop
590+
591+
loop:
592+
%iv = phi i16 [ 0, %ph ], [ %iv.next, %loop ]
593+
%gep.iv = getelementptr inbounds i32, ptr %p, i16 %iv
594+
store i32 0, ptr %gep.iv, align 1
595+
%gep.off.iv = getelementptr i32, ptr %gep.off, i16 %iv
596+
store i16 1, ptr %gep.off.iv, align 1
597+
%iv.next = add i16 %iv, 1
598+
%exit.cond = icmp eq i16 %iv.next, %n
599+
br i1 %exit.cond, label %exit, label %loop
600+
601+
exit:
602+
ret void
603+
}

0 commit comments

Comments
 (0)