Debian Codegraph @

llvm/test/Transforms/LoopInterchange/confused-dependence.ll

raw
1 ; RUN: opt < %s -passes=loop-interchange -pass-remarks-output=%t \
2 ; RUN: -disable-output
3 ; RUN: FileCheck -input-file %t %s
4
5 ;; In the following case, p0 and p1 may alias, so the direction vector must be [* *].
6 ;;
7 ;; void may_alias(float *p0, float *p1) {
8 ;; for (int i = 0; i < 4; i++)
9 ;; for (int j = 0; j < 4; j++)
10 ;; p0[4 * i + j] = p1[4 * j + i];
11 ;; }
12
13 ; CHECK: --- !Missed
14 ; CHECK-NEXT: Pass: loop-interchange
15 ; CHECK-NEXT: Name: Dependence
16 ; CHECK-NEXT: Function: may_alias
17 ; CHECK-NEXT: Args:
18 ; CHECK-NEXT: - String: All loops have dependencies in all directions.
19 ; CHECK-NEXT: ...
20 define void @may_alias(ptr %p0, ptr %p1) {
21 entry:
22 br label %for.i.header
23
24 for.i.header:
25 %i = phi i32 [ 0, %entry ], [ %i.inc, %for.i.latch ]
26 br label %for.j
27
28 for.j:
29 %j = phi i32 [ 0, %for.i.header ], [ %j.inc, %for.j ]
30 %idx.0 = getelementptr inbounds [4 x [4 x float]], ptr %p0, i32 0, i32 %j, i32 %i
31 %idx.1 = getelementptr inbounds [4 x [4 x float]], ptr %p1, i32 0, i32 %i, i32 %j
32 %0 = load float, ptr %idx.0, align 4
33 store float %0, ptr %idx.1, align 4
34 %j.inc = add nuw nsw i32 %j, 1
35 %cmp.j = icmp slt i32 %j.inc, 4
36 br i1 %cmp.j, label %for.j, label %for.i.latch
37
38 for.i.latch:
39 %i.inc = add nuw nsw i32 %i, 1
40 %cmp.i = icmp slt i32 %i.inc, 4
41 br i1 %cmp.i, label %for.i.header, label %exit
42
43 exit:
44 ret void
45 }