
This patch makes the final major change of the RemoveDIs project, changing the default IR output from debug intrinsics to debug records. This is expected to break a large number of tests: every single one that tests for uses or declarations of debug intrinsics and does not explicitly disable writing records. If this patch has broken your downstream tests (or upstream tests on a configuration I wasn't able to run): 1. If you need to immediately unblock a build, pass `--write-experimental-debuginfo=false` to LLVM's option processing for all failing tests (remember to use `-mllvm` for clang/flang to forward arguments to LLVM). 2. For most test failures, the changes are trivial and mechanical, enough that they can be done by script; see the migration guide for a guide on how to do this: https://llvm.org/docs/RemoveDIsDebugInfo.html#test-updates 3. If any tests fail for reasons other than FileCheck check lines that need updating, such as assertion failures, that is most likely a real bug with this patch and should be reported as such. For more information, see the recent PSA: https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578
82 lines
3.7 KiB
LLVM
82 lines
3.7 KiB
LLVM
; RUN: opt -S -passes=loop-rotate -verify-memoryssa < %s | FileCheck %s
|
|
|
|
;CHECK-LABEL: func
|
|
;CHECK-LABEL: entry
|
|
;CHECK-NEXT: #dbg_value(i32 %a
|
|
;CHECK-NEXT: #dbg_value(i32 1, ![[I_VAR:[0-9]+]], !DIExpression(),
|
|
;CHECK-LABEL: for.body:
|
|
;CHECK-NEXT: [[I:%.*]] = phi i32 [ 1, %entry ], [ %inc, %for.body ]
|
|
;CHECK-NEXT: #dbg_value(i32 [[I]], ![[I_VAR]], !DIExpression(),
|
|
|
|
; CHECK: ![[I_VAR]] = !DILocalVariable(name: "i",{{.*}})
|
|
|
|
; Function Attrs: noinline nounwind
|
|
define void @func(i32 %a) local_unnamed_addr #0 !dbg !6 {
|
|
entry:
|
|
tail call void @llvm.dbg.value(metadata i32 %a, metadata !10, metadata !11), !dbg !12
|
|
tail call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !11), !dbg !15
|
|
br label %for.cond, !dbg !16
|
|
|
|
for.cond: ; preds = %for.body, %entry
|
|
%i.0 = phi i32 [ 1, %entry ], [ %inc, %for.body ]
|
|
tail call void @llvm.dbg.value(metadata i32 %i.0, metadata !13, metadata !11), !dbg !15
|
|
%cmp = icmp slt i32 %i.0, 10, !dbg !17
|
|
br i1 %cmp, label %for.body, label %for.end, !dbg !20
|
|
|
|
for.body: ; preds = %for.cond
|
|
%add = add nsw i32 %i.0, %a, !dbg !22
|
|
%call = tail call i32 @func2(i32 %i.0, i32 %add) #3, !dbg !24
|
|
%inc = add nsw i32 %i.0, 1, !dbg !25
|
|
tail call void @llvm.dbg.value(metadata i32 %inc, metadata !13, metadata !11), !dbg !15
|
|
br label %for.cond, !dbg !27, !llvm.loop !28
|
|
|
|
for.end: ; preds = %for.cond
|
|
ret void, !dbg !31
|
|
}
|
|
|
|
declare i32 @func2(i32, i32) local_unnamed_addr
|
|
|
|
; Function Attrs: nounwind readnone
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
|
|
|
|
attributes #0 = { noinline nounwind }
|
|
attributes #2 = { nounwind readnone }
|
|
attributes #3 = { nounwind }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!3, !4}
|
|
!llvm.ident = !{!5}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
|
|
!1 = !DIFile(filename: "debug-phi.c", directory: "/work/projects/src/tests/debug")
|
|
!2 = !{}
|
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!5 = !{!"clang version 5.0.0"}
|
|
!6 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!7 = !DISubroutineType(types: !8)
|
|
!8 = !{null, !9}
|
|
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
!10 = !DILocalVariable(name: "a", arg: 1, scope: !6, file: !1, line: 2, type: !9)
|
|
!11 = !DIExpression()
|
|
!12 = !DILocation(line: 2, column: 15, scope: !6)
|
|
!13 = !DILocalVariable(name: "i", scope: !14, file: !1, line: 3, type: !9)
|
|
!14 = distinct !DILexicalBlock(scope: !6, file: !1, line: 3, column: 3)
|
|
!15 = !DILocation(line: 3, column: 11, scope: !14)
|
|
!16 = !DILocation(line: 3, column: 7, scope: !14)
|
|
!17 = !DILocation(line: 3, column: 20, scope: !18)
|
|
!18 = !DILexicalBlockFile(scope: !19, file: !1, discriminator: 1)
|
|
!19 = distinct !DILexicalBlock(scope: !14, file: !1, line: 3, column: 3)
|
|
!20 = !DILocation(line: 3, column: 3, scope: !21)
|
|
!21 = !DILexicalBlockFile(scope: !14, file: !1, discriminator: 1)
|
|
!22 = !DILocation(line: 4, column: 15, scope: !23)
|
|
!23 = distinct !DILexicalBlock(scope: !19, file: !1, line: 3, column: 31)
|
|
!24 = !DILocation(line: 4, column: 5, scope: !23)
|
|
!25 = !DILocation(line: 3, column: 27, scope: !26)
|
|
!26 = !DILexicalBlockFile(scope: !19, file: !1, discriminator: 2)
|
|
!27 = !DILocation(line: 3, column: 3, scope: !26)
|
|
!28 = distinct !{!28, !29, !30}
|
|
!29 = !DILocation(line: 3, column: 3, scope: !14)
|
|
!30 = !DILocation(line: 5, column: 3, scope: !14)
|
|
!31 = !DILocation(line: 6, column: 1, scope: !6)
|