13e48c8d7SOCHyams; RUN: opt -passes=declare-to-assign -S %s -o - \ 23e48c8d7SOCHyams; RUN: | FileCheck %s --check-prefix=WITHOUT-INTRINSIC 3*d3a6a90aSStephen Tozer; RUN: opt --try-experimental-debuginfo-iterators -passes=declare-to-assign -S %s -o - \ 4*d3a6a90aSStephen Tozer; RUN: | FileCheck %s --check-prefix=WITHOUT-INTRINSIC 53e48c8d7SOCHyams 63e48c8d7SOCHyams; RUN: sed 's/;Uncomment-with-sed//g' < %s \ 73e48c8d7SOCHyams; RUN: | opt -passes=declare-to-assign -S - -o - \ 83e48c8d7SOCHyams; RUN: | FileCheck %s --check-prefix=WITH-INTRINSIC 93e48c8d7SOCHyams 103e48c8d7SOCHyams; WITHOUT-INTRINSIC-NOT: "debug-info-assignment-tracking" 113e48c8d7SOCHyams; WITH-INTRINSIC: "debug-info-assignment-tracking" 123e48c8d7SOCHyams 133e48c8d7SOCHyams;; Check that the module flag "debug-info-assignment-tracking" is only added if 143e48c8d7SOCHyams;; declare-to-assign actually modifies the function. In the first run the 153e48c8d7SOCHyams;; dbg.declare is commented out and the pass leaves the function unmodified. 163e48c8d7SOCHyams;; In the second run sed is used to uncomment the dbg.declare and 173e48c8d7SOCHyams;; declare-to-assign replaces it with a dbg.assign. 183e48c8d7SOCHyams 193e48c8d7SOCHyamsdefine dso_local void @f() !dbg !9 { 203e48c8d7SOCHyamsentry: 213e48c8d7SOCHyams %a = alloca i32, align 4 223e48c8d7SOCHyams;Uncomment-with-sed call void @llvm.dbg.declare(metadata ptr %a, metadata !13, metadata !DIExpression()), !dbg !16 233e48c8d7SOCHyams ret void, !dbg !17 243e48c8d7SOCHyams} 253e48c8d7SOCHyams 263e48c8d7SOCHyamsdeclare void @llvm.dbg.declare(metadata, metadata, metadata) 273e48c8d7SOCHyams 283e48c8d7SOCHyams!llvm.dbg.cu = !{!0} 293e48c8d7SOCHyams!llvm.module.flags = !{!2, !3, !4, !5, !6, !7} 303e48c8d7SOCHyams!llvm.ident = !{!8} 313e48c8d7SOCHyams 323e48c8d7SOCHyams!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 17.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) 333e48c8d7SOCHyams!1 = !DIFile(filename: "test.c", directory: "/") 343e48c8d7SOCHyams!2 = !{i32 7, !"Dwarf Version", i32 5} 353e48c8d7SOCHyams!3 = !{i32 2, !"Debug Info Version", i32 3} 363e48c8d7SOCHyams!4 = !{i32 1, !"wchar_size", i32 4} 373e48c8d7SOCHyams!5 = !{i32 8, !"PIC Level", i32 2} 383e48c8d7SOCHyams!6 = !{i32 7, !"PIE Level", i32 2} 393e48c8d7SOCHyams!7 = !{i32 7, !"uwtable", i32 2} 403e48c8d7SOCHyams!8 = !{!"clang version 17.0.0"} 413e48c8d7SOCHyams!9 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !10, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12) 423e48c8d7SOCHyams!10 = !DISubroutineType(types: !11) 433e48c8d7SOCHyams!11 = !{null} 443e48c8d7SOCHyams!12 = !{!13} 453e48c8d7SOCHyams!13 = !DILocalVariable(name: "a", scope: !9, file: !1, line: 1, type: !14) 463e48c8d7SOCHyams!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 473e48c8d7SOCHyams!15 = !DILocation(line: 1, column: 12, scope: !9) 483e48c8d7SOCHyams!16 = !DILocation(line: 1, column: 16, scope: !9) 493e48c8d7SOCHyams!17 = !DILocation(line: 1, column: 19, scope: !9) 50