1 ; RUN: opt -basicaa -loop-versioning -S < %s | FileCheck %s
3 ; A very simple case. After versioning the %loadA and %loadB can't alias with
6 ; To see it easier what's going on, I expanded every noalias/scope metadata
7 ; reference below in a comment. For a scope I use the format scope(domain),
8 ; e.g. scope 17 in domain 15 is written as 17(15).
12 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
14 define void @f(i32* %a, i32* %b, i32* %c) {
18 ; CHECK: for.body.lver.orig:
20 for.body: ; preds = %for.body, %entry
21 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
23 %arrayidxA = getelementptr inbounds i32, i32* %a, i64 %ind
24 ; CHECK: %loadA = {{.*}} !alias.scope !0
25 ; A's scope: !0 -> { 1(2) }
26 %loadA = load i32, i32* %arrayidxA, align 4
28 %arrayidxB = getelementptr inbounds i32, i32* %b, i64 %ind
29 ; CHECK: %loadB = {{.*}} !alias.scope !3
30 ; B's scope: !3 -> { 4(2) }
31 %loadB = load i32, i32* %arrayidxB, align 4
33 %mulC = mul i32 %loadA, %loadB
35 %arrayidxC = getelementptr inbounds i32, i32* %c, i64 %ind
36 ; CHECK: store {{.*}} !alias.scope !5, !noalias !7
37 ; C noalias A and B: !7 -> { 1(2), 4(2) }
38 store i32 %mulC, i32* %arrayidxC, align 4
40 %add = add nuw nsw i64 %ind, 1
41 %exitcond = icmp eq i64 %add, 20
42 br i1 %exitcond, label %for.end, label %for.body
44 for.end: ; preds = %for.body
48 ; CHECK: !1 = distinct !{!1, !2}
49 ; CHECK: !2 = distinct !{!2, !"LVerDomain"}
51 ; CHECK: !4 = distinct !{!4, !2}
53 ; CHECK: !6 = distinct !{!6, !2}
54 ; CHECK: !7 = !{!1, !4}