1; RUN: opt %s -passes=loop-vectorize -force-vector-width=2 -force-vector-interleave=2 -S -o - \ 2; RUN: | FileCheck %s --implicit-check-not="call void @llvm.dbg" 3; RUN: opt --try-experimental-debuginfo-iterators %s -passes=loop-vectorize -force-vector-width=2 -force-vector-interleave=2 -S -o - \ 4; RUN: | FileCheck %s --implicit-check-not="call void @llvm.dbg" 5 6;; Check that loop-vectorize removes redundant debug intrinsics after it makes 7;; a change. This has a significant positive impact on peak memory and compiler 8;; run time. 9 10;; Check there is only one dbg.assign. 11; CHECK: #dbg_assign 12 13;; Check that the loop was actually modified. 14; CHECK: extractelement 15 16 17define void @test1(ptr noalias nocapture %a, ptr noalias nocapture readonly %b) { 18entry: 19 call void @llvm.dbg.assign(metadata ptr %a, metadata !11, metadata !DIExpression(), metadata !16, metadata ptr undef, metadata !DIExpression()), !dbg !28 20 call void @llvm.dbg.assign(metadata ptr %a, metadata !11, metadata !DIExpression(), metadata !16, metadata ptr undef, metadata !DIExpression()), !dbg !28 21 br label %for.body 22 23for.body: ; preds = %for.body, %entry 24 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 25 %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv 26 %0 = load float, ptr %arrayidx, align 4 27 %cmp1 = fcmp ogt float %0, 1.000000e+02 28 tail call void @llvm.assume(i1 %cmp1) 29 %add = fadd float %0, 1.000000e+00 30 %arrayidx5 = getelementptr inbounds float, ptr %a, i64 %indvars.iv 31 store float %add, ptr %arrayidx5, align 4 32 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 33 %exitcond = icmp eq i64 %indvars.iv, 1599 34 br i1 %exitcond, label %for.end, label %for.body 35 36for.end: ; preds = %for.body 37 ret void 38} 39 40declare void @llvm.assume(i1) #0 41declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) 42 43!llvm.dbg.cu = !{!0} 44!llvm.module.flags = !{!2, !3, !4, !5, !1000} 45!llvm.ident = !{!6} 46 47!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 14.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) 48!1 = !DIFile(filename: "test.cpp", directory: "/") 49!2 = !{i32 7, !"Dwarf Version", i32 5} 50!3 = !{i32 2, !"Debug Info Version", i32 3} 51!4 = !{i32 1, !"wchar_size", i32 4} 52!5 = !{i32 7, !"uwtable", i32 1} 53!6 = !{!"clang version 14.0.0)"} 54!7 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10) 55!8 = !DISubroutineType(types: !9) 56!9 = !{null} 57!10 = !{!11} 58!11 = !DILocalVariable(name: "Counter", scope: !7, file: !1, line: 3, type: !12) 59!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 60!16 = distinct !DIAssignID() 61!19 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 3) 62!28 = !DILocation(line: 6, column: 1, scope: !7) 63!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true} 64