1; RUN: opt %loadPolly -polly-use-runtime-alias-checks=false -pass-remarks-missed="polly-detect" -polly-detect-track-failures -polly-detect -analyze < %s 2>&1| FileCheck %s
2
3;void f(int A[], int B[]) {
4;  for (int i=0; i<42; i++)
5;    A[i] = B[i];
6;}
7
8; CHECK: remark: ReportAlias-01.c:2:8: The following errors keep this region from being a Scop.
9; CHECK: remark: ReportAlias-01.c:3:5: Accesses to the arrays "B", "A" may access the same memory.
10; CHECK: remark: ReportAlias-01.c:3:5: Invalid Scop candidate ends here.
11
12target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
13
14define void @f(i32* %A, i32* %B) !dbg !4 {
15entry:
16  br label %entry.split
17
18entry.split:                                      ; preds = %entry
19  tail call void @llvm.dbg.value(metadata i32* %A, i64 0, metadata !13, metadata !DIExpression()), !dbg !14
20  tail call void @llvm.dbg.value(metadata i32* %B, i64 0, metadata !15, metadata !DIExpression()), !dbg !16
21  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !18, metadata !DIExpression()), !dbg !20
22  br label %for.body, !dbg !21
23
24for.body:                                         ; preds = %entry.split, %for.body
25  %indvar = phi i64 [ 0, %entry.split ], [ %indvar.next, %for.body ]
26  %arrayidx = getelementptr i32, i32* %B, i64 %indvar, !dbg !22
27  %arrayidx2 = getelementptr i32, i32* %A, i64 %indvar, !dbg !22
28  %0 = load i32, i32* %arrayidx, align 4, !dbg !22
29  store i32 %0, i32* %arrayidx2, align 4, !dbg !22
30  tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !18, metadata !DIExpression()), !dbg !20
31  %indvar.next = add i64 %indvar, 1, !dbg !21
32  %exitcond = icmp ne i64 %indvar.next, 42, !dbg !21
33  br i1 %exitcond, label %for.body, label %for.end, !dbg !21
34
35for.end:                                          ; preds = %for.body
36  ret void, !dbg !23
37}
38
39declare void @llvm.dbg.declare(metadata, metadata, metadata)
40declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
41
42!llvm.dbg.cu = !{!0}
43!llvm.module.flags = !{!10, !11}
44!llvm.ident = !{!12}
45
46!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
47!1 = !DIFile(filename: "ReportAlias-01.c", directory: "test/ScopDetectionDiagnostic/")
48!2 = !{}
49!4 = distinct !DISubprogram(name: "f", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
50!5 = !DIFile(filename: "ReportAlias-01.c", directory: "test/ScopDetectionDiagnostic/")
51!6 = !DISubroutineType(types: !7)
52!7 = !{null, !8, !8}
53!8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !9)
54!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
55!10 = !{i32 2, !"Dwarf Version", i32 4}
56!11 = !{i32 2, !"Debug Info Version", i32 3}
57!12 = !{!"clang version 3.6.0 "}
58!13 = !DILocalVariable(name: "A", line: 1, arg: 1, scope: !4, file: !5, type: !8)
59!14 = !DILocation(line: 1, column: 12, scope: !4)
60!15 = !DILocalVariable(name: "B", line: 1, arg: 2, scope: !4, file: !5, type: !8)
61!16 = !DILocation(line: 1, column: 21, scope: !4)
62!17 = !{i32 0}
63!18 = !DILocalVariable(name: "i", line: 2, scope: !19, file: !5, type: !9)
64!19 = distinct !DILexicalBlock(line: 2, column: 3, file: !1, scope: !4)
65!20 = !DILocation(line: 2, column: 12, scope: !19)
66!21 = !DILocation(line: 2, column: 8, scope: !19)
67!22 = !DILocation(line: 3, column: 5, scope: !19)
68!23 = !DILocation(line: 4, column: 1, scope: !4)
69