1; Confirm that the line numbers for the middle.block operations are all the 2; same as the start of the loop. 3 4; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-interleave=4 <%s | FileCheck %s 5; 6; CHECK: middle.block: 7; CHECK-NEXT: %{{.*}}= add <4 x i32>{{.*}}, !dbg ![[DL:[0-9]+]] 8; CHECK-NEXT: %{{.*}}= add <4 x i32>{{.*}}, !dbg ![[DL]] 9; CHECK-NEXT: %{{.*}}= add <4 x i32>{{.*}}, !dbg ![[DL]] 10; CHECK-NEXT: %{{.*}}= shufflevector <4 x i32>{{.*}}, !dbg ![[DL]] 11; CHECK-NEXT: %{{.*}}= add <4 x i32>{{.*}}, !dbg ![[DL]] 12; CHECK-NEXT: %{{.*}}= shufflevector <4 x i32>{{.*}}, !dbg ![[DL]] 13; CHECK-NEXT: %{{.*}}= add <4 x i32>{{.*}}, !dbg ![[DL]] 14; CHECK-NEXT: %{{.*}}= extractelement <4 x i32>{{.*}}, !dbg ![[DL]] 15; CHECK-NEXT: %{{.*}}= icmp eq i64{{.*}}, !dbg ![[DL]] 16; CHECK-NEXT: br i1 %{{.*}}, !dbg ![[DL]] 17; CHECK: ![[DL]] = !DILocation(line: 5, 18 19; This IR can be generated by running: 20; clang -gmlt -S src.cpp -emit-llvm -mllvm -opt-bisect-limit=56 -O2 -o - 21; 22; Where src.cpp contains: 23; int foo(int count, int *bar) 24; { 25; int ret = count; 26; int tmp; 27; for (int j = 0; j < count; j++) { 28; tmp = bar[j]; 29; ret += tmp; 30; } 31; 32; return ret; 33; } 34 35define dso_local i32 @"foo"(i32 %count, i32* nocapture readonly %bar) local_unnamed_addr !dbg !8 { 36entry: 37 %cmp8 = icmp sgt i32 %count, 0, !dbg !10 38 br i1 %cmp8, label %for.body.preheader, label %for.cond.cleanup, !dbg !10 39 40for.body.preheader: ; preds = %entry 41 %wide.trip.count = zext i32 %count to i64 42 br label %for.body, !dbg !11 43 44for.cond.cleanup.loopexit: ; preds = %for.body 45 %add.lcssa = phi i32 [ %add, %for.body ], !dbg !12 46 br label %for.cond.cleanup, !dbg !13 47 48for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry 49 %ret.0.lcssa = phi i32 [ %count, %entry ], [ %add.lcssa, %for.cond.cleanup.loopexit ], !dbg !14 50 ret i32 %ret.0.lcssa, !dbg !13 51 52for.body: ; preds = %for.body, %for.body.preheader 53 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] 54 %ret.09 = phi i32 [ %count, %for.body.preheader ], [ %add, %for.body ] 55 %arrayidx = getelementptr inbounds i32, i32* %bar, i64 %indvars.iv, !dbg !11 56 %0 = load i32, i32* %arrayidx, align 4, !dbg !11, !tbaa !15 57 %add = add nsw i32 %0, %ret.09, !dbg !12 58 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !10 59 %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count, !dbg !10 60 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body, !dbg !10, !llvm.loop !19 61} 62 63!llvm.dbg.cu = !{!0} 64!llvm.module.flags = !{!3, !4, !5, !6} 65!llvm.ident = !{!7} 66 67!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, nameTableKind: None) 68!1 = !DIFile(filename: "src.cpp", directory: "") 69!2 = !{} 70!3 = !{i32 2, !"CodeView", i32 1} 71!4 = !{i32 2, !"Debug Info Version", i32 3} 72!5 = !{i32 1, !"wchar_size", i32 2} 73!6 = !{i32 7, !"PIC Level", i32 2} 74!7 = !{!""} 75!8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) 76!9 = !DISubroutineType(types: !2) 77!10 = !DILocation(line: 5, scope: !8) 78!11 = !DILocation(line: 6, scope: !8) 79!12 = !DILocation(line: 7, scope: !8) 80!13 = !DILocation(line: 10, scope: !8) 81!14 = !DILocation(line: 0, scope: !8) 82!15 = !{!16, !16, i64 0} 83!16 = !{!"int", !17, i64 0} 84!17 = !{!"omnipotent char", !18, i64 0} 85!18 = !{!"Simple C++ TBAA"} 86!19 = distinct !{!19, !10, !20} 87!20 = !DILocation(line: 8, scope: !8) 88