1*b941857bSCongzhe Cao; RUN: opt < %s -basic-aa -loop-interchange -cache-line-size=64 -pass-remarks='loop-interchange' -pass-remarks-output=%t -S \
2cee313d2SEric Christopher; RUN:     -verify-dom-info -verify-loop-info | FileCheck %s
3cee313d2SEric Christopher; RUN: FileCheck -check-prefix=REMARK --input-file=%t %s
4cee313d2SEric Christopher
5cee313d2SEric Christopher
6cee313d2SEric Christophertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7cee313d2SEric Christopher
8cee313d2SEric Christopher@A = common global [100 x [100 x i64]] zeroinitializer
9cee313d2SEric Christopher
10cee313d2SEric Christopher;;  for(int i=0;i<100;i++)
11cee313d2SEric Christopher;;    for(int j=0;j<100;j++)
12cee313d2SEric Christopher;;      A[j][i] = A[j][i]+k;
13cee313d2SEric Christopher
14cee313d2SEric Christopher; REMARK:      Name:            Interchanged
15cee313d2SEric Christopher; REMARK-NEXT: Function:        interchange_01
16cee313d2SEric Christopher; CHECK: split
17cee313d2SEric Christopher
18cee313d2SEric Christopherdefine void @interchange_01(i64 %k, i64 %N) !dbg !5 {
19cee313d2SEric Christopherentry:
20cee313d2SEric Christopher  br label %for1.header
21cee313d2SEric Christopher
22cee313d2SEric Christopherfor1.header:
23cee313d2SEric Christopher  %j23 = phi i64 [ 0, %entry ], [ %j.next24, %for1.inc10 ]
24cee313d2SEric Christopher  call void @llvm.dbg.value(metadata i64 %j, metadata !13, metadata !DIExpression()), !dbg !14
25cee313d2SEric Christopher  br label %for2
26cee313d2SEric Christopher
27cee313d2SEric Christopherfor2:
28cee313d2SEric Christopher  %j = phi i64 [ %j.next, %for2 ], [ 0, %for1.header ]
29cee313d2SEric Christopher  call void @llvm.dbg.value(metadata i64 %j, metadata !13, metadata !DIExpression()), !dbg !14
30cee313d2SEric Christopher  %arrayidx5 = getelementptr inbounds [100 x [100 x i64]], [100 x [100 x i64]]* @A, i64 0, i64 %j, i64 %j23
31cee313d2SEric Christopher  %lv = load i64, i64* %arrayidx5
32cee313d2SEric Christopher  %add = add nsw i64 %lv, %k
33cee313d2SEric Christopher  store i64 %add, i64* %arrayidx5
34cee313d2SEric Christopher  %j.next = add nuw nsw i64 %j, 1
35cee313d2SEric Christopher  %exitcond = icmp eq i64 %j, 99
36cee313d2SEric Christopher  call void @llvm.dbg.value(metadata i64 %j, metadata !13, metadata !DIExpression()), !dbg !14
37cee313d2SEric Christopher  br i1 %exitcond, label %for1.inc10, label %for2
38cee313d2SEric Christopher
39cee313d2SEric Christopherfor1.inc10:
40cee313d2SEric Christopher  %j.next24 = add nuw nsw i64 %j23, 1
41cee313d2SEric Christopher  call void @llvm.dbg.value(metadata i64 %j, metadata !13, metadata !DIExpression()), !dbg !14
42cee313d2SEric Christopher  %exitcond26 = icmp eq i64 %j23, 99
43cee313d2SEric Christopher  br i1 %exitcond26, label %for.end12, label %for1.header
44cee313d2SEric Christopher
45cee313d2SEric Christopherfor.end12:
46cee313d2SEric Christopher  ret void
47cee313d2SEric Christopher}
48cee313d2SEric Christopher
49cee313d2SEric Christopher; Function Attrs: nounwind readnone speculatable
50cee313d2SEric Christopherdeclare void @llvm.dbg.value(metadata, metadata, metadata)
51cee313d2SEric Christopher
52cee313d2SEric Christopher!llvm.dbg.cu = !{!0}
53cee313d2SEric Christopher!llvm.module.flags = !{!3, !4}
54cee313d2SEric Christopher
55cee313d2SEric Christopher!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
56cee313d2SEric Christopher!1 = !DIFile(filename: "test.c", directory: "/test")
57cee313d2SEric Christopher!2 = !{}
58cee313d2SEric Christopher!3 = !{i32 2, !"Dwarf Version", i32 4}
59cee313d2SEric Christopher!4 = !{i32 2, !"Debug Info Version", i32 3}
60cee313d2SEric Christopher!5 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
61cee313d2SEric Christopher!6 = !DISubroutineType(types: !7)
62cee313d2SEric Christopher!7 = !{null, !8, !8, !11}
63cee313d2SEric Christopher!8 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !9)
64cee313d2SEric Christopher!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 32, align: 32)
65cee313d2SEric Christopher!10 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float)
66cee313d2SEric Christopher!11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
67cee313d2SEric Christopher!12 = !{!13}
68cee313d2SEric Christopher!13 = !DILocalVariable(name: "a", arg: 1, scope: !5, file: !1, line: 1, type: !8)
69cee313d2SEric Christopher!14 = !DILocation(line: 1, column: 27, scope: !5)
70