brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.6 KiB · ccbaca0 Raw
126 lines · plain
1; RUN: llc %s -o - -stop-after=finalize-isel \2; RUN: | FileCheck %s --implicit-check-not=DBG_3 4;; Test coalescing of contiguous fragments in adjacent location definitions.5;; Further details and check directives inline.6 7target triple = "x86_64-unknown-linux-gnu"8 9;; The final store and linked dbg.assign indicate the whole variable is located10;; on the stack. Coalesce the two fragment defs that are generated (0-32,11;; 32-64) at the final dbg.assign into one (0-64, which covers the whole12;; variable meaning we don't need a fragment expression). And check the13;; first two DBG_VALUEs are not coalesced, since they specify different14;; locations.15; CHECK: _Z3fun16; CHECK-LABEL: bb.0.entry:17; CHECK-NEXT: DBG_VALUE 1, $noreg, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 0, 32)18; CHECK-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_plus_uconst, 4, DW_OP_deref, DW_OP_LLVM_fragment, 32, 32)19; CHECK-NEXT: MOV32mi %stack.0.a, 1, $noreg, 0, $noreg, 520; CHECK-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_deref)21; CHECK-NEXT: RET22define dso_local void @_Z3funv() local_unnamed_addr !dbg !16 {23entry:24  %a = alloca i64, !DIAssignID !3725  call void @llvm.dbg.assign(metadata i64 poison, metadata !20, metadata !DIExpression(), metadata !37, metadata ptr %a, metadata !DIExpression()), !dbg !2526  call void @llvm.dbg.value(metadata i32 1, metadata !20, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !2527  store i32 5, ptr %a, !DIAssignID !3828  call void @llvm.dbg.assign(metadata i32 5, metadata !20, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32), metadata !38, metadata ptr %a, metadata !DIExpression()), !dbg !2529  ret void30}31 32;; Similar to the test above except that the variable has been split over two33;; allocas, so coalescing should not take place (different memory location for34;; the fragments).35; CHECK: Z3funv236; CHECK-LABEL: bb.0.entry:37; CHECK-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 0, 32)38; CHECK-NEXT: DBG_VALUE %stack.1.b, $noreg, ![[#]], !DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 32, 32)39; CHECK-NEXT: DBG_VALUE 1, $noreg, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 0, 32)40; CHECK-NEXT: MOV32mi %stack.0.a, 1, $noreg, 0, $noreg, 541;; Both fragments 0-32 and 32-64 are in memory now, but located in different stack slots.42; CHECK-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 0, 32)43; CHECK-NEXT: RET44define dso_local void @_Z3funv2() local_unnamed_addr !dbg !39 {45entry:46  %a = alloca i32, !DIAssignID !4247  call void @llvm.dbg.assign(metadata i64 poison, metadata !41, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32), metadata !42, metadata ptr %a, metadata !DIExpression()), !dbg !4448  %b = alloca i32, !DIAssignID !4549  call void @llvm.dbg.assign(metadata i64 poison, metadata !41, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32), metadata !45, metadata ptr %b, metadata !DIExpression()), !dbg !4450  call void @llvm.dbg.value(metadata i32 1, metadata !41, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !4451  store i32 5, ptr %a, !DIAssignID !4352  call void @llvm.dbg.assign(metadata i32 5, metadata !41, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32), metadata !43, metadata ptr %a, metadata !DIExpression()), !dbg !4453  ret void54}55 56;; Similar to the first test above except the part that it's the slice 16-3257;; that is "partially promoted". The dbg defs after the alloca cannot be58;; coalesced (slices 0-16 and 32-64 are in memory but 16-32 isn't). The entire59;; variable is on the stack after the store.60; CHECK: _Z2funv361; CHECK-LABEL: bb.0.entry:62; CHECK-NEXT: DBG_VALUE 2, $noreg, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 16, 16)63; CHECK-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 0, 16)64; CHECK-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_plus_uconst, 4, DW_OP_deref, DW_OP_LLVM_fragment, 32, 32)65; CHECK-NEXT: MOV32mi %stack.0.a, 1, $noreg, 0, $noreg, 566; CHECK-NEXT: DBG_VALUE %stack.0.a, $noreg, ![[#]], !DIExpression(DW_OP_deref)67; CHECK-NEXT: RET68define dso_local void @_Z2funv3() local_unnamed_addr !dbg !46 {69entry:70  %a = alloca i64, !DIAssignID !4971  call void @llvm.dbg.assign(metadata i64 poison, metadata !48, metadata !DIExpression(), metadata !49, metadata ptr %a, metadata !DIExpression()), !dbg !5172  call void @llvm.dbg.value(metadata i32 2, metadata !48, metadata !DIExpression(DW_OP_LLVM_fragment, 16, 16)), !dbg !5173  store i32 5, ptr %a, !DIAssignID !5074  call void @llvm.dbg.assign(metadata i32 5, metadata !48, metadata !DIExpression(DW_OP_LLVM_fragment, 16, 16), metadata !50, metadata ptr %a, metadata !DIExpression(DW_OP_plus_uconst, 2)), !dbg !5175  ret void76}77 78declare void @llvm.dbg.value(metadata, metadata, metadata)79declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)80 81!llvm.dbg.cu = !{!2}82!llvm.module.flags = !{!8, !9, !10, !11, !12, !13, !14}83!llvm.ident = !{!15}84 85!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())86!1 = distinct !DIGlobalVariable(name: "G", scope: !2, file: !3, line: 1, type: !7, isLocal: false, isDefinition: true)87!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 17.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)88!3 = !DIFile(filename: "test.cpp", directory: "/")89!4 = !{!0, !5}90!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())91!6 = distinct !DIGlobalVariable(name: "F", scope: !2, file: !3, line: 1, type: !7, isLocal: false, isDefinition: true)92!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)93!8 = !{i32 7, !"Dwarf Version", i32 5}94!9 = !{i32 2, !"Debug Info Version", i32 3}95!10 = !{i32 1, !"wchar_size", i32 4}96!11 = !{i32 8, !"PIC Level", i32 2}97!12 = !{i32 7, !"PIE Level", i32 2}98!13 = !{i32 7, !"uwtable", i32 2}99!14 = !{i32 7, !"debug-info-assignment-tracking", i1 true}100!15 = !{!"clang version 17.0.0"}101!16 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 3, type: !17, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !19)102!17 = !DISubroutineType(types: !18)103!18 = !{null}104!19 = !{!20}105!20 = !DILocalVariable(name: "X", scope: !16, file: !3, line: 4, type: !21)106!21 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Pair", file: !3, line: 2, size: 64, flags: DIFlagTypePassByValue, elements: !22, identifier: "_ZTS4Pair")107!22 = !{}108!25 = !DILocation(line: 0, scope: !16)109!26 = !DILocation(line: 7, column: 7, scope: !27)110!27 = distinct !DILexicalBlock(scope: !16, file: !3, line: 7, column: 7)111!37 = distinct !DIAssignID()112!38 = distinct !DIAssignID()113!39 = distinct !DISubprogram(name: "fun2", linkageName: "_Z3funv2", scope: !3, file: !3, line: 3, type: !17, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !40)114!40 = !{!41}115!41 = !DILocalVariable(name: "X", scope: !39, file: !3, line: 10, type: !21)116!42 = distinct !DIAssignID()117!43 = distinct !DIAssignID()118!44 = !DILocation(line: 0, scope: !39)119!45 = distinct !DIAssignID()120!46 = distinct !DISubprogram(name: "fun3", linkageName: "_Z3funv3", scope: !3, file: !3, line: 3, type: !17, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !47)121!47 = !{!48}122!48 = !DILocalVariable(name: "X", scope: !46, file: !3, line: 10, type: !21)123!49 = distinct !DIAssignID()124!50 = distinct !DIAssignID()125!51 = !DILocation(line: 0, scope: !46)126