1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck %s
4 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6 define void @forward_dep_known_safe_due_to_backedge_taken_count(ptr %A) {
7 ; CHECK-LABEL: 'forward_dep_known_safe_due_to_backedge_taken_count'
9 ; CHECK-NEXT: Memory dependences are safe
10 ; CHECK-NEXT: Dependences:
11 ; CHECK-NEXT: Run-time memory checks:
12 ; CHECK-NEXT: Grouped accesses:
14 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
15 ; CHECK-NEXT: SCEV assumptions:
17 ; CHECK-NEXT: Expressions re-written:
20 %A.511= getelementptr inbounds i32, ptr %A, i64 511
24 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
25 %iv.mul.2 = shl nuw nsw i64 %iv, 1
26 %gep.mul.2 = getelementptr inbounds i32, ptr %A.511, i64 %iv.mul.2
27 %l = load i32, ptr %gep.mul.2, align 4
28 %add = add nsw i32 %l, 5
29 %gep = getelementptr inbounds i32, ptr %A, i64 %iv
30 store i32 %add, ptr %gep, align 4
31 %iv.next = add nuw nsw i64 %iv, 1
32 %exitcond.not = icmp eq i64 %iv.next, 256
33 br i1 %exitcond.not, label %exit, label %loop
39 define void @forward_dep_not_known_safe_due_to_backedge_taken_count(ptr %A) {
40 ; CHECK-LABEL: 'forward_dep_not_known_safe_due_to_backedge_taken_count'
42 ; CHECK-NEXT: Memory dependences are safe
43 ; CHECK-NEXT: Dependences:
44 ; CHECK-NEXT: Forward:
45 ; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
46 ; CHECK-NEXT: store i32 %add, ptr %gep, align 4
48 ; CHECK-NEXT: Run-time memory checks:
49 ; CHECK-NEXT: Grouped accesses:
51 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
52 ; CHECK-NEXT: SCEV assumptions:
54 ; CHECK-NEXT: Expressions re-written:
57 %A.510 = getelementptr inbounds i32, ptr %A, i64 510
61 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
62 %iv.mul.2 = shl nuw nsw i64 %iv, 1
63 %gep.mul.2 = getelementptr inbounds i32, ptr %A.510, i64 %iv.mul.2
64 %l = load i32, ptr %gep.mul.2, align 4
65 %add = add nsw i32 %l, 5
66 %gep = getelementptr inbounds i32, ptr %A, i64 %iv
67 store i32 %add, ptr %gep, align 4
68 %iv.next = add nuw nsw i64 %iv, 1
69 %exitcond.not = icmp eq i64 %iv.next, 256
70 br i1 %exitcond.not, label %exit, label %loop
76 define void @unknown_dep_known_safe_due_to_backedge_taken_count(ptr %A) {
77 ; CHECK-LABEL: 'unknown_dep_known_safe_due_to_backedge_taken_count'
79 ; CHECK-NEXT: Memory dependences are safe
80 ; CHECK-NEXT: Dependences:
81 ; CHECK-NEXT: Run-time memory checks:
82 ; CHECK-NEXT: Grouped accesses:
84 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
85 ; CHECK-NEXT: SCEV assumptions:
87 ; CHECK-NEXT: Expressions re-written:
90 %A.511 = getelementptr inbounds i32, ptr %A, i64 511
94 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
95 %iv.mul.2 = shl nuw nsw i64 %iv, 1
96 %gep = getelementptr inbounds i32, ptr %A, i64 %iv
97 %l = load i32, ptr %gep, align 4
98 %add = add nsw i32 %l, 5
99 %gep.mul.2 = getelementptr inbounds i32, ptr %A.511, i64 %iv.mul.2
100 store i32 %add, ptr %gep.mul.2, align 4
101 %iv.next = add nuw nsw i64 %iv, 1
102 %exitcond.not = icmp eq i64 %iv.next, 256
103 br i1 %exitcond.not, label %exit, label %loop
109 define void @unknown_dep_not_known_safe_due_to_backedge_taken_count(ptr %A) {
110 ; CHECK-LABEL: 'unknown_dep_not_known_safe_due_to_backedge_taken_count'
112 ; 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
113 ; CHECK-NEXT: Unknown data dependence.
114 ; CHECK-NEXT: Dependences:
115 ; CHECK-NEXT: Unknown:
116 ; CHECK-NEXT: %l = load i32, ptr %gep, align 4 ->
117 ; CHECK-NEXT: store i32 %add, ptr %gep.mul.2, align 4
119 ; CHECK-NEXT: Run-time memory checks:
120 ; CHECK-NEXT: Grouped accesses:
122 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
123 ; CHECK-NEXT: SCEV assumptions:
125 ; CHECK-NEXT: Expressions re-written:
128 %A.510 = getelementptr inbounds i32, ptr %A, i64 510
132 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
133 %iv.mul.2 = shl nuw nsw i64 %iv, 1
134 %gep = getelementptr inbounds i32, ptr %A, i64 %iv
135 %l = load i32, ptr %gep, align 4
136 %add = add nsw i32 %l, 5
137 %gep.mul.2 = getelementptr inbounds i32, ptr %A.510, i64 %iv.mul.2
138 store i32 %add, ptr %gep.mul.2, align 4
139 %iv.next = add nuw nsw i64 %iv, 1
140 %exitcond.not = icmp eq i64 %iv.next, 256
141 br i1 %exitcond.not, label %exit, label %loop