1; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 < %s | FileCheck %s --check-prefix=ASM 2; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 < %s -filetype=obj | llvm-readobj -codeview | FileCheck %s --check-prefix=OBJ 3 4; This LL file was generated by running 'clang -O1 -g -gcodeview' on the 5; following code: 6; 1: extern volatile int x; 7; 2: static inline void foo() { 8; 3: int y = 1; 9; 4: x += (int)&y; 10; 5: x += 2; 11; 6: x += 3; 12; 7: } 13; 8: static inline void bar() { 14; 9: x += 4; 15; 10: foo(); 16; 11: x += 5; 17; 12: } 18; 13: void baz() { 19; 14: x += 6; 20; 15: bar(); 21; 16: x += 7; 22; 17: } 23 24; ASM: .cv_loc 0 1 13 0 is_stmt 0 # t.cpp:13:0 25; ASM: .cv_loc 0 1 14 5 # t.cpp:14:5 26; ASM: addl $6, "?x@@3HC" 27; ASM: .cv_loc 1 1 9 5 # t.cpp:9:5 28; ASM: addl $4, "?x@@3HC" 29; ASM: .cv_loc 2 1 3 7 # t.cpp:3:7 30; ASM: .cv_loc 2 1 4 5 # t.cpp:4:5 31; ASM: addl {{.*}}, "?x@@3HC" 32; ASM: .cv_loc 2 1 5 5 # t.cpp:5:5 33; ASM: addl $2, "?x@@3HC" 34; ASM: .cv_loc 2 1 6 5 # t.cpp:6:5 35; ASM: addl $3, "?x@@3HC" 36; ASM: .cv_loc 1 1 11 5 # t.cpp:11:5 37; ASM: addl $5, "?x@@3HC" 38; ASM: .cv_loc 0 1 16 5 # t.cpp:16:5 39; ASM: addl $7, "?x@@3HC" 40; ASM: .cv_loc 0 1 17 1 # t.cpp:17:1 41 42; ASM: .section .debug$S,"dr" 43; ASM: .long 246 # Inlinee lines subsection 44; ASM: .long [[inline_end:.*]]-[[inline_beg:.*]] # 45; ASM: [[inline_beg]]: 46; ASM: .long 0 47; ASM: # Inlined function bar starts at t.cpp:8 48; ASM: .long 4098 # Type index of inlined function 49; ASM: .long 0 # Offset into filechecksum table 50; ASM: .long 8 # Starting line number 51; ASM: # Inlined function foo starts at t.cpp:2 52; ASM: .long 4099 53; ASM: .long 0 54; ASM: .long 2 55; ASM: [[inline_end]]: 56 57; ASM: .long 241 # Symbol subsection for baz 58; ASM: .long {{.*}} # Subsection size 59; ASM: .short 4429 60; ASM: .long 61; ASM: .long 62; ASM: .long 63; ASM: .cv_inline_linetable 1 1 8 Lfunc_begin0 Lfunc_end0 contains 2 64; ASM: .short 4429 65; ASM: .long 66; ASM: .long 67; ASM: .long 68; ASM: .cv_inline_linetable 2 1 2 Lfunc_begin0 Lfunc_end0 69; ASM: .short 4430 70; ASM: .short 4430 71 72; ASM: .section .debug$T,"dr" 73; ASM: .long 4 # Debug section magic 74; ASM: # ArgList (0x1000) { 75; ASM: # TypeLeafKind: LF_ARGLIST (0x1201) 76; ASM: # NumArgs: 0 77; ASM: # Arguments [ 78; ASM: # ] 79; ASM: # } 80; ASM: .byte 0x06, 0x00, 0x01, 0x12 81; ASM: .byte 0x00, 0x00, 0x00, 0x00 82; ASM: # Procedure (0x1001) { 83; ASM: # TypeLeafKind: LF_PROCEDURE (0x1008) 84; ASM: # ReturnType: void (0x3) 85; ASM: # CallingConvention: NearC (0x0) 86; ASM: # FunctionOptions [ (0x0) 87; ASM: # ] 88; ASM: # NumParameters: 0 89; ASM: # ArgListType: () (0x1000) 90; ASM: # } 91; ASM: .byte 0x0e, 0x00, 0x08, 0x10 92; ASM: .byte 0x03, 0x00, 0x00, 0x00 93; ASM: .byte 0x00, 0x00, 0x00, 0x00 94; ASM: .byte 0x00, 0x10, 0x00, 0x00 95; ASM: # FuncId (0x1002) { 96; ASM: # TypeLeafKind: LF_FUNC_ID (0x1601) 97; ASM: # ParentScope: 0x0 98; ASM: # FunctionType: void () (0x1001) 99; ASM: # Name: bar 100; ASM: # } 101; ASM: .byte 0x0e, 0x00, 0x01, 0x16 102; ASM: .byte 0x00, 0x00, 0x00, 0x00 103; ASM: .byte 0x01, 0x10, 0x00, 0x00 104; ASM: .byte 0x62, 0x61, 0x72, 0x00 105; ASM: # FuncId (0x1003) { 106; ASM: # TypeLeafKind: LF_FUNC_ID (0x1601) 107; ASM: # ParentScope: 0x0 108; ASM: # FunctionType: void () (0x1001) 109; ASM: # Name: foo 110; ASM: # } 111; ASM: .byte 0x0e, 0x00, 0x01, 0x16 112; ASM: .byte 0x00, 0x00, 0x00, 0x00 113; ASM: .byte 0x01, 0x10, 0x00, 0x00 114; ASM: .byte 0x66, 0x6f, 0x6f, 0x00 115 116; We should only the LF_FUNC_ID records that we needed to reference. 117; OBJ: CodeViewTypes [ 118; OBJ: Section: .debug$T 119; OBJ: ArgList (0x1000) { 120; OBJ: TypeLeafKind: LF_ARGLIST (0x1201) 121; OBJ: NumArgs: 0 122; OBJ: } 123; OBJ: Procedure (0x1001) { 124; OBJ: TypeLeafKind: LF_PROCEDURE (0x1008) 125; OBJ: ReturnType: void (0x3) 126; OBJ: NumParameters: 0 127; OBJ: ArgListType: () (0x1000) 128; OBJ: } 129; OBJ: FuncId (0x1002) { 130; OBJ: TypeLeafKind: LF_FUNC_ID (0x1601) 131; OBJ: ParentScope: 0x0 132; OBJ: FunctionType: void () (0x1001) 133; OBJ: Name: bar 134; OBJ: } 135; OBJ: FuncId (0x1003) { 136; OBJ: TypeLeafKind: LF_FUNC_ID (0x1601) 137; OBJ: ParentScope: 0x0 138; OBJ: FunctionType: void () (0x1001) 139; OBJ: Name: foo 140; OBJ: } 141; OBJ: FuncId (0x1004) { 142; OBJ: TypeLeafKind: LF_FUNC_ID (0x1601) 143; OBJ: ParentScope: 0x0 144; OBJ: FunctionType: void () (0x1001) 145; OBJ: Name: baz 146; OBJ: } 147; OBJ-NOT: TypeLeafKind: LF_FUNC_ID 148; OBJ: ] 149 150; OBJ: Subsection [ 151; OBJ: SubSectionType: InlineeLines (0xF6) 152; OBJ: SubSectionSize: 0x1C 153; OBJ: InlineeSourceLine { 154; OBJ: Inlinee: bar (0x1002) 155; OBJ: FileID: D:\src\llvm\build\t.cpp (0x0) 156; OBJ: SourceLineNum: 8 157; OBJ: } 158; OBJ: InlineeSourceLine { 159; OBJ: Inlinee: foo (0x1003) 160; OBJ: FileID: D:\src\llvm\build\t.cpp (0x0) 161; OBJ: SourceLineNum: 2 162; OBJ: } 163; OBJ: ] 164; OBJ: Subsection [ 165; OBJ: SubSectionType: Symbols (0xF1) 166; OBJ: ProcStart { 167; OBJ: PtrParent: 0x0 168; OBJ: PtrEnd: 0x0 169; OBJ: PtrNext: 0x0 170; OBJ: CodeSize: 0x3D 171; OBJ: DbgStart: 0x0 172; OBJ: DbgEnd: 0x0 173; OBJ: FunctionType: baz (0x1004) 174; OBJ: CodeOffset: ?baz@@YAXXZ+0x0 175; OBJ: Segment: 0x0 176; OBJ: Flags [ (0x0) 177; OBJ: ] 178; OBJ: DisplayName: baz 179; OBJ: LinkageName: ?baz@@YAXXZ 180; OBJ: } 181; OBJ: InlineSite { 182; OBJ: PtrParent: 0x0 183; OBJ: PtrEnd: 0x0 184; OBJ: Inlinee: bar (0x1002) 185; OBJ: BinaryAnnotations [ 186; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x8, LineOffset: 1} 187; OBJ-NEXT: ChangeLineOffset: -6 188; OBJ-NEXT: ChangeCodeOffset: 0x7 189; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xA, LineOffset: 1} 190; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1} 191; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1} 192; OBJ-NEXT: ChangeLineOffset: 5 193; OBJ-NEXT: ChangeCodeOffset: 0x7 194; OBJ-NEXT: ChangeCodeLength: 0x7 195; OBJ: ] 196; OBJ: } 197; OBJ: InlineSite { 198; OBJ: PtrParent: 0x0 199; OBJ: PtrEnd: 0x0 200; OBJ: Inlinee: foo (0x1003) 201; OBJ: BinaryAnnotations [ 202; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xF, LineOffset: 1} 203; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xA, LineOffset: 1} 204; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1} 205; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1} 206; OBJ-NEXT: ChangeCodeLength: 0x7 207; OBJ: ] 208; OBJ: } 209; OBJ: InlineSiteEnd { 210; OBJ: } 211; OBJ: InlineSiteEnd { 212; OBJ: } 213; OBJ: ProcEnd 214; OBJ: ] 215 216; ModuleID = 't.cpp' 217target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 218target triple = "x86_64-pc-windows-msvc18.0.0" 219 220@"\01?x@@3HC" = external global i32, align 4 221 222; Function Attrs: norecurse nounwind uwtable 223define void @"\01?baz@@YAXXZ"() #0 !dbg !4 { 224entry: 225 %y.i.i = alloca i32, align 4 226 %0 = load volatile i32, i32* @"\01?x@@3HC", align 4, !dbg !12, !tbaa !13 227 %add = add nsw i32 %0, 6, !dbg !12 228 store volatile i32 %add, i32* @"\01?x@@3HC", align 4, !dbg !12, !tbaa !13 229 %1 = load volatile i32, i32* @"\01?x@@3HC", align 4, !dbg !17, !tbaa !13 230 %add.i = add nsw i32 %1, 4, !dbg !17 231 store volatile i32 %add.i, i32* @"\01?x@@3HC", align 4, !dbg !17, !tbaa !13 232 %2 = bitcast i32* %y.i.i to i8*, !dbg !19 233 call void @llvm.lifetime.start(i64 4, i8* %2) #2, !dbg !19 234 store i32 1, i32* %y.i.i, align 4, !dbg !21, !tbaa !13 235 %3 = ptrtoint i32* %y.i.i to i64, !dbg !22 236 %4 = trunc i64 %3 to i32, !dbg !22 237 %5 = load volatile i32, i32* @"\01?x@@3HC", align 4, !dbg !23, !tbaa !13 238 %add.i.i = add nsw i32 %5, %4, !dbg !23 239 store volatile i32 %add.i.i, i32* @"\01?x@@3HC", align 4, !dbg !23, !tbaa !13 240 %6 = load volatile i32, i32* @"\01?x@@3HC", align 4, !dbg !24, !tbaa !13 241 %add1.i.i = add nsw i32 %6, 2, !dbg !24 242 store volatile i32 %add1.i.i, i32* @"\01?x@@3HC", align 4, !dbg !24, !tbaa !13 243 %7 = load volatile i32, i32* @"\01?x@@3HC", align 4, !dbg !25, !tbaa !13 244 %add2.i.i = add nsw i32 %7, 3, !dbg !25 245 store volatile i32 %add2.i.i, i32* @"\01?x@@3HC", align 4, !dbg !25, !tbaa !13 246 call void @llvm.lifetime.end(i64 4, i8* %2) #2, !dbg !26 247 %8 = load volatile i32, i32* @"\01?x@@3HC", align 4, !dbg !27, !tbaa !13 248 %add1.i = add nsw i32 %8, 5, !dbg !27 249 store volatile i32 %add1.i, i32* @"\01?x@@3HC", align 4, !dbg !27, !tbaa !13 250 %9 = load volatile i32, i32* @"\01?x@@3HC", align 4, !dbg !28, !tbaa !13 251 %add1 = add nsw i32 %9, 7, !dbg !28 252 store volatile i32 %add1, i32* @"\01?x@@3HC", align 4, !dbg !28, !tbaa !13 253 ret void, !dbg !29 254} 255 256; Function Attrs: argmemonly nounwind 257declare void @llvm.lifetime.start(i64, i8* nocapture) #1 258 259; Function Attrs: argmemonly nounwind 260declare void @llvm.lifetime.end(i64, i8* nocapture) #1 261 262attributes #0 = { norecurse nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 263attributes #1 = { argmemonly nounwind } 264attributes #2 = { nounwind } 265 266!llvm.dbg.cu = !{!0} 267!llvm.module.flags = !{!8, !9, !10} 268!llvm.ident = !{!11} 269 270!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2) 271!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild") 272!2 = !{} 273!4 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 13, type: !5, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2) 274!5 = !DISubroutineType(types: !2) 275!6 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 8, type: !5, isLocal: true, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2) 276!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !5, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2) 277!8 = !{i32 2, !"CodeView", i32 1} 278!9 = !{i32 2, !"Debug Info Version", i32 3} 279!10 = !{i32 1, !"PIC Level", i32 2} 280!11 = !{!"clang version 3.9.0 "} 281!12 = !DILocation(line: 14, column: 5, scope: !4) 282!13 = !{!14, !14, i64 0} 283!14 = !{!"int", !15, i64 0} 284!15 = !{!"omnipotent char", !16, i64 0} 285!16 = !{!"Simple C/C++ TBAA"} 286!17 = !DILocation(line: 9, column: 5, scope: !6, inlinedAt: !18) 287!18 = distinct !DILocation(line: 15, column: 3, scope: !4) 288!19 = !DILocation(line: 3, column: 3, scope: !7, inlinedAt: !20) 289!20 = distinct !DILocation(line: 10, column: 3, scope: !6, inlinedAt: !18) 290!21 = !DILocation(line: 3, column: 7, scope: !7, inlinedAt: !20) 291!22 = !DILocation(line: 4, column: 8, scope: !7, inlinedAt: !20) 292!23 = !DILocation(line: 4, column: 5, scope: !7, inlinedAt: !20) 293!24 = !DILocation(line: 5, column: 5, scope: !7, inlinedAt: !20) 294!25 = !DILocation(line: 6, column: 5, scope: !7, inlinedAt: !20) 295!26 = !DILocation(line: 7, column: 1, scope: !7, inlinedAt: !20) 296!27 = !DILocation(line: 11, column: 5, scope: !6, inlinedAt: !18) 297!28 = !DILocation(line: 16, column: 5, scope: !4) 298!29 = !DILocation(line: 17, column: 1, scope: !4) 299