1 ; RUN: opt %s -sroa -verify -S -o - | FileCheck %s 2 ; ModuleID = 'test.c' 3 ; Test that SROA updates the debug info correctly if an alloca was rewritten but 4 ; not partitioned into multiple allocas. 5 ; 6 ; CHECK: call void @llvm.dbg.value(metadata float %s.coerce, i64 0, metadata ![[VAR:[0-9]+]], metadata ![[EXPR:[0-9]+]]) 7 ; CHECK: ![[VAR]] = !DILocalVariable(name: "s",{{.*}} line: 3, 8 ; CHECK: ![[EXPR]] = !DIExpression( 9 ; CHECK-NOT: DW_OP_bit_piece 10 11 ; 12 ; struct S { float f; }; 13 ; 14 ; float foo(struct S s) { 15 ; return s.f; 16 ; } 17 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 18 target triple = "x86_64-apple-macosx10.10.0" 19 20 %struct.S = type { float } 21 22 ; Function Attrs: nounwind ssp uwtable 23 define float @foo(float %s.coerce) #0 !dbg !4 { 24 entry: 25 %s = alloca %struct.S, align 4 26 %coerce.dive = getelementptr %struct.S, %struct.S* %s, i32 0, i32 0 27 store float %s.coerce, float* %coerce.dive, align 1 28 call void @llvm.dbg.declare(metadata %struct.S* %s, metadata !16, metadata !17), !dbg !18 29 %f = getelementptr inbounds %struct.S, %struct.S* %s, i32 0, i32 0, !dbg !19 30 %0 = load float, float* %f, align 4, !dbg !19 31 ret float %0, !dbg !19 32 } 33 34 ; Function Attrs: nounwind readnone 35 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 36 37 attributes #0 = { nounwind ssp uwtable } 38 attributes #1 = { nounwind readnone } 39 40 !llvm.dbg.cu = !{!0} 41 !llvm.module.flags = !{!12, !13, !14} 42 !llvm.ident = !{!15} 43 44 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) 45 !1 = !DIFile(filename: "test.c", directory: "/Volumes/Data/llvm/_build.ninja.debug") 46 !2 = !{} 47 !3 = !{!4} 48 !4 = distinct !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !5, type: !6, variables: !2) 49 !5 = !DIFile(filename: "test.c", directory: "/Volumes/Data/llvm/_build.ninja.debug") 50 !6 = !DISubroutineType(types: !7) 51 !7 = !{!8, !9} 52 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float) 53 !9 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 1, size: 32, align: 32, file: !1, elements: !10) 54 !10 = !{!11} 55 !11 = !DIDerivedType(tag: DW_TAG_member, name: "f", line: 1, size: 32, align: 32, file: !1, scope: !9, baseType: !8) 56 !12 = !{i32 2, !"Dwarf Version", i32 2} 57 !13 = !{i32 2, !"Debug Info Version", i32 3} 58 !14 = !{i32 1, !"PIC Level", i32 2} 59 !15 = !{!"clang version 3.6.0 "} 60 !16 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !4, file: !5, type: !9) 61 !17 = !DIExpression() 62 !18 = !DILocation(line: 3, column: 20, scope: !4) 63 !19 = !DILocation(line: 4, column: 2, scope: !4) 64