1 ; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
2 ; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
5 ; for (i = 0; i < n; i++)
6 ; A[i + 1] = A[i] * B[i] * C[i];
8 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
11 ; CHECK: Has convergent operation in loop
12 ; CHECK: Report: cannot add control dependency to convergent operation
13 ; CHECK-NEXT: Dependences:
14 ; CHECK-NEXT: Backward:
15 ; CHECK-NEXT: %loadA = load i16, i16* %arrayidxA, align 2 ->
16 ; CHECK-NEXT: store i16 %mul1, i16* %arrayidxA_plus_2, align 2
17 ; CHECK: Run-time memory checks:
19 ; CHECK-NEXT: Comparing group
20 ; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %storemerge3
21 ; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add
22 ; CHECK-NEXT: Against group
23 ; CHECK-NEXT: %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %storemerge3
25 ; CHECK-NEXT: Comparing group
26 ; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %storemerge3
27 ; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add
28 ; CHECK-NEXT: Against group
29 ; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %storemerge3
31 @B = common global i16* null, align 8
32 @A = common global i16* null, align 8
33 @C = common global i16* null, align 8
37 %a = load i16*, i16** @A, align 8
38 %b = load i16*, i16** @B, align 8
39 %c = load i16*, i16** @C, align 8
42 for.body: ; preds = %for.body, %entry
43 %storemerge3 = phi i64 [ 0, %entry ], [ %add, %for.body ]
45 %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %storemerge3
46 %loadA = load i16, i16* %arrayidxA, align 2
48 %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %storemerge3
49 %loadB = load i16, i16* %arrayidxB, align 2
51 %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %storemerge3
52 %loadC = load i16, i16* %arrayidxC, align 2
54 call void @llvm.convergent()
56 %mul = mul i16 %loadB, %loadA
57 %mul1 = mul i16 %mul, %loadC
59 %add = add nuw nsw i64 %storemerge3, 1
60 %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add
61 store i16 %mul1, i16* %arrayidxA_plus_2, align 2
63 %exitcond = icmp eq i64 %add, 20
64 br i1 %exitcond, label %for.end, label %for.body
66 for.end: ; preds = %for.body
70 declare void @llvm.convergent() #0
72 attributes #0 = { nounwind readnone convergent }
73 attributes #1 = { nounwind convergent }