brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.0 KiB · e34cb1a Raw
135 lines · plain
1; RUN: opt -passes=inline -S < %s | FileCheck %s2; RUN: opt -passes='cgscc(inline)' -S < %s | FileCheck %s3 4; struct A {5;   int arg0;6;   double arg1[2];7; } a, b;8;9; void fn3(A p1) {10;   if (p1.arg0)11;     a = p1;12; }13;14; void fn4() { fn3(b); }15;16; void fn5() {17;   while (1)18;     fn4();19; }20; ModuleID = 'test.cpp'21source_filename = "test/Transforms/Inline/alloca-dbgdeclare.ll"22target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"23target triple = "aarch64-apple-darwin"24 25%struct.A = type { i32, [2 x double] }26 27@a = global %struct.A zeroinitializer, align 8, !dbg !028@b = global %struct.A zeroinitializer, align 8, !dbg !1229 30; Function Attrs: nounwind31declare void @_Z3fn31A(ptr nocapture readonly) #032 33; Function Attrs: nounwind readnone34declare void @llvm.dbg.declare(metadata, metadata, metadata) #135 36; Function Attrs: argmemonly nounwind37declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #238 39; Function Attrs: nounwind40define void @_Z3fn4v() #0 !dbg !22 {41entry:42; Test that the dbg.declare is moved together with the alloca.43; CHECK: define void @_Z3fn5v()44; CHECK-NEXT: entry:45; CHECK-NEXT:   %agg.tmp.sroa.3.i = alloca [20 x i8], align 446; CHECK-NEXT:   br label %while.body47; CHECK:      while.body:48; CHECK-NEXT:   llvm.lifetime.start49; CHECK-NEXT:   #dbg_declare(ptr %agg.tmp.sroa.3.i,50  %agg.tmp.sroa.3 = alloca [20 x i8], align 451  tail call void @llvm.dbg.declare(metadata ptr %agg.tmp.sroa.3, metadata !25, metadata !30), !dbg !3152  %agg.tmp.sroa.0.0.copyload = load i32, ptr @b, align 8, !dbg !3353  tail call void @llvm.dbg.value(metadata i32 %agg.tmp.sroa.0.0.copyload, metadata !25, metadata !34), !dbg !3154  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.tmp.sroa.3, ptr align 4 getelementptr (i8, ptr @b, i64 4), i64 20, i1 false), !dbg !3355  tail call void @llvm.dbg.declare(metadata ptr undef, metadata !25, metadata !35) #0, !dbg !3156  %tobool.i = icmp eq i32 %agg.tmp.sroa.0.0.copyload, 0, !dbg !3657  br i1 %tobool.i, label %_Z3fn31A.exit, label %if.then.i, !dbg !3858 59if.then.i:                                        ; preds = %entry60  store i32 %agg.tmp.sroa.0.0.copyload, ptr @a, align 8, !dbg !3961  call void @llvm.memcpy.p0.p0.i64(ptr align 4 getelementptr (i8, ptr @a, i64 4), ptr align 4 %agg.tmp.sroa.3, i64 20, i1 false), !dbg !3962  br label %_Z3fn31A.exit, !dbg !3963 64_Z3fn31A.exit:                                    ; preds = %if.then.i, %entry65 66  ret void, !dbg !3367}68 69; Function Attrs: noreturn nounwind70define void @_Z3fn5v() #3 !dbg !40 {71entry:72  br label %while.body, !dbg !4173 74while.body:                                       ; preds = %while.body, %entry75  call void @_Z3fn4v(), !dbg !4276  br label %while.body, !dbg !4177}78 79; Function Attrs: nounwind readnone80declare void @llvm.dbg.value(metadata, metadata, metadata) #181 82attributes #0 = { nounwind }83attributes #1 = { nounwind readnone }84attributes #2 = { argmemonly nounwind }85attributes #3 = { noreturn nounwind }86 87!llvm.dbg.cu = !{!14}88!llvm.module.flags = !{!19, !20}89!llvm.ident = !{!21}90 91!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())92!1 = !DIGlobalVariable(name: "a", scope: null, file: !2, line: 4, type: !3, isLocal: false, isDefinition: true)93!2 = !DIFile(filename: "test.cpp", directory: "")94!3 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !2, line: 1, size: 192, align: 64, elements: !4, identifier: "_ZTS1A")95!4 = !{!5, !7}96!5 = !DIDerivedType(tag: DW_TAG_member, name: "arg0", scope: !3, file: !2, line: 2, baseType: !6, size: 32, align: 32)97!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)98!7 = !DIDerivedType(tag: DW_TAG_member, name: "arg1", scope: !3, file: !2, line: 3, baseType: !8, size: 128, align: 64, offset: 64)99!8 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 128, align: 64, elements: !10)100!9 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)101!10 = !{!11}102!11 = !DISubrange(count: 2)103!12 = !DIGlobalVariableExpression(var: !13, expr: !DIExpression())104!13 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 4, type: !3, isLocal: false, isDefinition: true)105!14 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !15, producer: "clang version 3.7.0 (trunk 227480) (llvm/trunk 227517)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !16, retainedTypes: !17, globals: !18, imports: !16)106!15 = !DIFile(filename: "<stdin>", directory: "")107!16 = !{}108!17 = !{!3}109!18 = !{!0, !12}110!19 = !{i32 2, !"Dwarf Version", i32 4}111!20 = !{i32 2, !"Debug Info Version", i32 3}112!21 = !{!"clang version 3.7.0 (trunk 227480) (llvm/trunk 227517)"}113!22 = distinct !DISubprogram(name: "fn4", linkageName: "_Z3fn4v", scope: !2, file: !2, line: 11, type: !23, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: true, unit: !14, retainedNodes: !16)114!23 = !DISubroutineType(types: !24)115!24 = !{null}116!25 = !DILocalVariable(name: "p1", arg: 1, scope: !26, file: !2, line: 6, type: !3)117!26 = distinct !DISubprogram(name: "fn3", linkageName: "_Z3fn31A", scope: !2, file: !2, line: 6, type: !27, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !14, retainedNodes: !29)118!27 = !DISubroutineType(types: !28)119!28 = !{null, !3}120!29 = !{!25}121!30 = !DIExpression(DW_OP_LLVM_fragment, 32, 160)122!31 = !DILocation(line: 6, scope: !26, inlinedAt: !32)123!32 = distinct !DILocation(line: 11, scope: !22)124!33 = !DILocation(line: 11, scope: !22)125!34 = !DIExpression(DW_OP_LLVM_fragment, 0, 32)126!35 = !DIExpression(DW_OP_deref)127!36 = !DILocation(line: 7, scope: !37, inlinedAt: !32)128!37 = distinct !DILexicalBlock(scope: !26, file: !2, line: 7)129!38 = !DILocation(line: 7, scope: !26, inlinedAt: !32)130!39 = !DILocation(line: 8, scope: !37, inlinedAt: !32)131!40 = distinct !DISubprogram(name: "fn5", linkageName: "_Z3fn5v", scope: !2, file: !2, line: 13, type: !23, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: true, unit: !14, retainedNodes: !16)132!41 = !DILocation(line: 14, scope: !40)133!42 = !DILocation(line: 15, scope: !40)134 135