brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 73b4fd0 Raw
82 lines · plain
1; RUN: llc %s -stop-after=finalize-isel -o - \2; RUN: | FileCheck %s --implicit-check-not=DBG_3 4;; Check that SelectionDAG downgrades dbg.assigns to dbg.values if assignment5;; tracking isn't enabled (e.g. if the module flag6;; "debug-info-assignment-tracking" is missing / false).7 8;; With assignment tracking enabled we'd see the variable put into the stack9;; slot side table because the variable is always located in its stack10;; slot. Check there's no debug-info saved there:11;; CHECK: stack:12;; CHECK-NEXT: - { id: 0, name: x, type: default, offset: 0, size: 4, alignment: 4,13;; CHECK-NEXT:     stack-id: default, callee-saved-register: '', callee-saved-restored: true,14;; CHECK-NEXT:     debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }15 16;; With assignment tracking disabled we should see the dbg.assigns downgraded17;; to dbg.values, which become DBG _VALUEs/_INSTR_REFs.18; CHECK: bb.0.entry:19; CHECK: DBG_VALUE $noreg20 21; CHECK: bb.1.if.then:22; CHECK: DBG_INSTR_REF23 24; CHECK: bb.2.if.else:25; CHECK: DBG_VALUE 226 27target triple = "x86_64-unknown-unknown"28 29@g = dso_local global i32 0, align 4, !dbg !030 31define dso_local noundef i32 @_Z3funv() #0 !dbg !15 {32entry:33  %x = alloca i32, align 4, !DIAssignID !1934  call void @llvm.dbg.assign(metadata i1 undef, metadata !20, metadata !DIExpression(), metadata !19, metadata ptr %x, metadata !DIExpression()), !dbg !2135  %0 = load i32, ptr @g, align 436  %tobool = icmp ne i32 %0, 037  br i1 %tobool, label %if.then, label %if.else38 39if.then:                                          ; preds = %entry40  %call = call noundef i32 @_Z3getv()41  store i32 %call, ptr %x, align 4, !DIAssignID !2742  call void @llvm.dbg.assign(metadata i32 %call, metadata !20, metadata !DIExpression(), metadata !27, metadata ptr %x, metadata !DIExpression()), !dbg !2143  br label %if.end44 45if.else:                                          ; preds = %entry46  store i32 2, ptr %x, align 4, !DIAssignID !3047  call void @llvm.dbg.assign(metadata i32 2, metadata !20, metadata !DIExpression(), metadata !30, metadata ptr %x, metadata !DIExpression()), !dbg !2148  br label %if.end49 50if.end:                                           ; preds = %if.else, %if.then51  %1 = load i32, ptr %x, align 452  ret i32 %153}54 55declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #156declare void @llvm.dbg.declare(metadata, metadata, metadata) #157declare noundef i32 @_Z3getv() #258 59!llvm.dbg.cu = !{!2}60!llvm.module.flags = !{!6, !7}61!llvm.ident = !{!14}62 63!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())64!1 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !3, line: 1, type: !5, isLocal: false, isDefinition: true)65!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 17.0.0)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)66!3 = !DIFile(filename: "test.cpp", directory: "/")67!4 = !{!0}68!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)69!6 = !{i32 7, !"Dwarf Version", i32 5}70!7 = !{i32 2, !"Debug Info Version", i32 3}71!14 = !{!"clang version 17.0.0"}72!15 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 3, type: !16, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)73!16 = !DISubroutineType(types: !17)74!17 = !{!5}75!18 = !{}76!19 = distinct !DIAssignID()77!20 = !DILocalVariable(name: "x", scope: !15, file: !3, line: 4, type: !5)78!21 = !DILocation(line: 0, scope: !15)79!23 = distinct !DILexicalBlock(scope: !15, file: !3, line: 5, column: 7)80!27 = distinct !DIAssignID()81!30 = distinct !DIAssignID()82