brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · 145b504 Raw
114 lines · plain
1; RUN: llc -mtriple=x86_64-unknown-unknown %s -o - -stop-after=livedebugvalues -experimental-debug-variable-locations=true | FileCheck %s2;3; In the simple loop below, the location of the variable "toast" is %bar in4; the entry block, then set to constant zero at the end of the loop. We cannot5; know the location of "toast" at the start of the %loop block. Test that no6; location is given until after the call to @booler.7;8; Second function @baz added with an even tighter loop -- this tests different9; code-paths through LiveDebugValues. Any blocks with an incoming backedge need10; reconsideration after the parent of the backedge has had its OutLocs11; initialized, even if OutLocs hasn't changed.12;13; Third function @quux tests that we don't delete too many variable locations.14; A variable that is live across the body of the loop should maintain its15; location across that loop, and not be invalidated.16;17; CHECK: ![[FOOVARNUM:[0-9]+]] = !DILocalVariable(name: "toast"18; CHECK: ![[BAZVARNUM:[0-9]+]] = !DILocalVariable(name: "crumpets"19; CHECK: ![[QUUXVARNUM:[0-9]+]] = !DILocalVariable(name: "teacake"20;21; foo tests22; CHECK-LABEL: bb.1.loop23; CHECK-NOT:   DBG_VALUE24; CHECK-LABEL: CALL64pcrel32 @booler25; CHECK:       DBG_VALUE 0, $noreg, ![[FOOVARNUM]]26;27; baz tests28; CHECK-LABEL: name: baz29; CHECK-LABEL: bb.1.loop30; CHECK-NOT:   DBG_VALUE31; CHECK-LABEL: CALL64pcrel32 @booler32; CHECK:       DBG_VALUE 0, $noreg, ![[BAZVARNUM]]33;34; quux tests -- the variable arrives in $edi, should get a non-undef location35; before the loop, and its position re-stated in each block.36; CHECK-LABEL: name: quux37; CHECK:       DBG_VALUE $edi, $noreg, ![[QUUXVARNUM]]38; CHECK-LABEL: bb.1.loop39; CHECK:       DBG_VALUE $ebx, $noreg, ![[QUUXVARNUM]]40; CHECK-NOT:   DBG_VALUE $noreg41; CHECK-LABEL: bb.2.exit42; CHECK:       DBG_VALUE $ebx, $noreg, ![[QUUXVARNUM]]43; CHECK-NOT:   DBG_VALUE $noreg44 45declare dso_local i1 @booler()46declare dso_local void @escape(i32)47declare void @llvm.dbg.value(metadata, metadata, metadata)48@glob = global i32 049 50define i32 @foo(i32 %bar) !dbg !4 {51entry:52  call void @llvm.dbg.value(metadata i32 %bar, metadata !3, metadata !DIExpression()), !dbg !653  br label %loop54loop:55  call void @escape(i32 %bar)56  %retval = call i1 @booler(), !dbg !657  call void @llvm.dbg.value(metadata i32 0, metadata !3, metadata !DIExpression()), !dbg !658  br i1 %retval, label %loop2, label %exit59loop2:60  store i32 %bar, ptr @glob61  br label %loop62exit:63  ret i32 %bar64}65 66define i32 @baz(i32 %bar) !dbg !104 {67entry:68  call void @llvm.dbg.value(metadata i32 %bar, metadata !103, metadata !DIExpression()), !dbg !10669  br label %loop70loop:71  call void @escape(i32 %bar)72  %retval = call i1 @booler(), !dbg !10673  call void @llvm.dbg.value(metadata i32 0, metadata !103, metadata !DIExpression()), !dbg !10674  br i1 %retval, label %loop, label %exit75exit:76  ret i32 %bar77}78 79define i32 @quux(i32 %bar) !dbg !204 {80entry:81  ; %bar will be placed in a nonvolatile or spill location for the loop,82  ; before being returned later.83  call void @llvm.dbg.value(metadata i32 %bar, metadata !203, metadata !DIExpression()), !dbg !20684  br label %loop85loop:86  %retval = call i1 @booler(), !dbg !20687  br i1 %retval, label %loop, label %exit88exit:89  ret i32 %bar90}91 92!llvm.module.flags = !{!0, !100}93!llvm.dbg.cu = !{!1}94 95!100 = !{i32 2, !"Dwarf Version", i32 4}96!0 = !{i32 2, !"Debug Info Version", i32 3}97!1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "beards", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)98!2 = !DIFile(filename: "bees.cpp", directory: ".")99!3 = !DILocalVariable(name: "toast", scope: !4, file: !2, line: 1, type: !16)100!4 = distinct !DISubprogram(name: "nope", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !13, type: !14, isDefinition: true)101!6 = !DILocation(line: 1, scope: !4)102!13 = !{!3}103!14 = !DISubroutineType(types: !15)104!15 = !{!16}105!16 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)106!103 = !DILocalVariable(name: "crumpets", scope: !104, file: !2, line: 1, type: !16)107!104 = distinct !DISubprogram(name: "ribbit", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !113, type: !14, isDefinition: true)108!106 = !DILocation(line: 1, scope: !104)109!113 = !{!103}110!203 = !DILocalVariable(name: "teacake", scope: !204, file: !2, line: 1, type: !16)111!204 = distinct !DISubprogram(name: "toad", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !213, type: !14, isDefinition: true)112!206 = !DILocation(line: 1, scope: !204)113!213 = !{!203}114