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