1; RUN: llc -stop-before=expand-isel-pseudos -pre-RA-sched=linearize < %s | FileCheck %s 2source_filename = "linear-dbg-value.ll" 3 4; Function Attrs: nounwind readonly uwtable 5define i32 @foo(i32* nocapture readonly %a, i32 %N) local_unnamed_addr #0 !dbg !6 { 6entry: 7 %cmp6 = icmp sgt i32 %N, 0, !dbg !11 8 br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup, !dbg !15 9 10for.body.preheader: ; preds = %entry 11 %wide.trip.count = zext i32 %N to i64 12 br label %for.body, !dbg !17 13 14for.cond.cleanup.loopexit: ; preds = %for.body 15 br label %for.cond.cleanup, !dbg !19 16 17for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry 18 %x.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.cond.cleanup.loopexit ] 19 ret i32 %x.0.lcssa, !dbg !19 20 21for.body: ; preds = %for.body, %for.body.preheader 22; CHECK: ![[X:[0-9]+]] = !DILocalVariable(name: "x", 23; CHECK-LABEL: bb.3.for.body: 24; CHECK: DBG_VALUE {{.*}} ![[X]], !DIExpression() 25; CHECK: DBG_VALUE {{.*}} ![[X]], !DIExpression() 26 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] 27 %x.07 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ] 28 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv, !dbg !17 29 %0 = load i32, i32* %arrayidx, align 4, !dbg !17 30 %add = add nsw i32 %0, %x.07, !dbg !17 31 call void @llvm.dbg.value(metadata i32 %add, metadata !9, metadata !DIExpression()), !dbg !20 32 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !21 33 call void @llvm.dbg.value(metadata i32 %add, metadata !9, metadata !DIExpression()), !dbg !20 34 %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count, !dbg !11 35 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body, !dbg !15 36} 37 38; Function Attrs: nounwind readnone speculatable 39declare void @llvm.dbg.value(metadata, metadata, metadata) #1 40 41attributes #0 = { nounwind readonly uwtable } 42attributes #1 = { nounwind readnone speculatable } 43 44!llvm.dbg.cu = !{!0} 45!llvm.module.flags = !{!3, !4} 46!llvm.ident = !{!5} 47 48!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.1 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 49!1 = !DIFile(filename: "foo.c", directory: "/tmp") 50!2 = !{} 51!3 = !{i32 2, !"Dwarf Version", i32 4} 52!4 = !{i32 2, !"Debug Info Version", i32 3} 53!5 = !{!"clang version 4.0.1 "} 54!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !8) 55!7 = !DISubroutineType(types: !2) 56!8 = !{!9} 57!9 = !DILocalVariable(name: "x", scope: !6, file: !1, line: 3, type: !10) 58!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 59!11 = !DILocation(line: 4, scope: !12) 60!12 = !DILexicalBlockFile(scope: !13, file: !1, discriminator: 1) 61!13 = distinct !DILexicalBlock(scope: !14, file: !1, line: 4, column: 3) 62!14 = distinct !DILexicalBlock(scope: !6, file: !1, line: 4, column: 3) 63!15 = !DILocation(line: 4, scope: !16) 64!16 = !DILexicalBlockFile(scope: !14, file: !1, discriminator: 1) 65!17 = !DILocation(line: 5, scope: !18) 66!18 = distinct !DILexicalBlock(scope: !13, file: !1, line: 4, column: 31) 67!19 = !DILocation(line: 7, scope: !6) 68!20 = !DILocation(line: 3, scope: !6) 69!21 = !DILocation(line: 4, scope: !22) 70!22 = !DILexicalBlockFile(scope: !13, file: !1, discriminator: 3) 71