[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / Transforms / LoopInterchange / unique-dep-matrix.ll
blobe5c18830784acc349e3bb9f1d0c794a6be2b26da
1 ; REQUIRES: asserts
2 ; RUN: opt < %s -passes=loop-interchange -S -debug 2>&1 | FileCheck %s
4 ; CHECK:       Dependency matrix before interchange:
5 ; CHECK-NEXT:  I I
6 ; CHECK-NEXT:  = *
7 ; CHECK-NEXT:  < *
8 ; CHECK-NEXT:  Processing InnerLoopId
10 ; This example is taken from github issue #54176
12 define void @foo(i32 noundef %n, i32 noundef %m, ptr nocapture noundef %aa, ptr nocapture noundef readonly %bb, ptr nocapture noundef writeonly %cc) {
13 entry:
14   %arrayidx7 = getelementptr inbounds i8, ptr %aa, i64 512
15   br label %for.cond1.preheader
17 for.cond1.preheader:
18   %indvars.iv32 = phi i64 [ 1, %entry ], [ %indvars.iv.next33, %for.cond.cleanup3 ]
19   %0 = add nsw i64 %indvars.iv32, -1
20   %arrayidx9 = getelementptr inbounds [128 x float], ptr %arrayidx7, i64 0, i64 %0
21   %arrayidx12 = getelementptr inbounds [128 x float], ptr %arrayidx7, i64 0, i64 %indvars.iv32
22   br label %for.body4
24 for.cond.cleanup:
25   ret void
27 for.cond.cleanup3:
28   %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
29   %exitcond36 = icmp ne i64 %indvars.iv.next33, 128
30   br i1 %exitcond36, label %for.cond1.preheader, label %for.cond.cleanup
32 for.body4:
33   %indvars.iv = phi i64 [ 1, %for.cond1.preheader ], [ %indvars.iv.next, %for.body4 ]
34   %arrayidx6 = getelementptr inbounds [128 x float], ptr %bb, i64 %indvars.iv, i64 %indvars.iv32
35   %1 = load float, ptr %arrayidx6, align 4
36   %2 = load float, ptr %arrayidx9, align 4
37   %add = fadd fast float %2, %1
38   store float %add, ptr %arrayidx9, align 4
39   %3 = load float, ptr %arrayidx12, align 4
40   %arrayidx16 = getelementptr inbounds [128 x float], ptr %cc, i64 %indvars.iv, i64 %indvars.iv32
41   store float %3, ptr %arrayidx16, align 4
42   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
43   %exitcond = icmp ne i64 %indvars.iv.next, 1024
44   br i1 %exitcond, label %for.body4, label %for.cond.cleanup3