1 # REQUIRES: x86-registered-target
2 # RUN: llvm-mc -filetype=obj --triple=x86_64-pc-windows-msvc %s | llvm-readobj - --codeview --codeview-subsection-bytes | FileCheck %s
4 # Rust source to regenerate:
6 # extern "C" fn add_numbers(x: &Option<i32>, y: &Option<i32>) -> i32 {
11 # $ rustc trailing-inlined-function.rs --crate-type cdylib --emit=asm -Copt-level=3 -Cpanic=abort -Cdebuginfo=1
13 # Validate that unwrap() was inlined.
14 # CHECK: InlineSiteSym {
15 # CHECK-NEXT: Kind: S_INLINESITE (0x114D)
16 # CHECK-NEXT: PtrParent: 0x0
17 # CHECK-NEXT: PtrEnd: 0x0
18 # CHECK-NEXT: Inlinee: unwrap
19 # CHECK-NEXT: BinaryAnnotations [
20 # CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: [[#%#x,Offset1_1:]], LineOffset: 1}
21 # CHECK-NEXT: ChangeCodeLength: [[#%#x,Length1_1:]]
22 # CHECK-NEXT: ChangeLineOffset: 2
23 # CHECK-NEXT: ChangeCodeOffset: [[#%#x,Offset1_2:]]
24 # CHECK-NEXT: ChangeCodeLength: [[#%#x,]]
25 # CHECK-NEXT: (Annotation Padding)
26 # CHECK: InlineSiteSym {
27 # CHECK-NEXT: Kind: S_INLINESITE (0x114D)
28 # CHECK-NEXT: PtrParent: 0x0
29 # CHECK-NEXT: PtrEnd: 0x0
30 # CHECK-NEXT: Inlinee: unwrap
31 # CHECK-NEXT: BinaryAnnotations [
32 # CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: [[#%#x,Offset2_1:]], LineOffset: 1}
33 # CHECK-NEXT: ChangeCodeLength: [[#%#x,Length2_1:]]
34 # CHECK-NEXT: ChangeLineOffset: 2
35 # CHECK-NEXT: ChangeCodeOffset: [[#%#x,Offset2_2:]]
36 # CHECK-NEXT: ChangeCodeLength: [[#%#x,]]
37 # CHECK-NEXT: (Annotation Padding)
39 # Validate that basic blocks from an inlined function that are sunk below the rest of the function
40 # (namely bb1 and bb4 in this test) get the correct debug info.
41 # CHECK: SubSectionType: Lines (0xF2)
42 # CHECK-NEXT: SubSectionSize: [[#%#x,]]
43 # CHECK-NEXT: SubSectionContents (
44 # CHECK-NEXT: 0000: [[#%.8X,]] [[#%.8X,]] [[#%.8X,]] [[#%.8X,]]
45 # Code starts at line 2
46 # CHECK-NEXT: 0010: [[#%.8X,]] [[#%.8X,]] [[#%.8X,]] 02000000
47 # The success paths for unwrap() (lines 3 & 4) are next.
48 # CHECK-NEXT: 0020: [[#%.2X,Offset1_1]]000000 03000000 [[#%.2X,Offset2_1]]000000 04000000
49 # Then the addition (line 5) and the end of the function (end-brace on line 6).
50 # CHECK-NEXT: 0030: [[#%.8X,]] 05000000 [[#%.8X,]] 06000000
51 # The failure paths for unwrap() (lines 3 & 4) are placed after the `ret` instruction.
52 # CHECK-NEXT: 0040: [[#%.2X,Offset1_1 + Length1_1 + Offset1_2]]000000 03000000 [[#%.2X,Offset2_1 + Length2_1 + Offset2_2]]000000 04000000
53 # CHECK-NOT: SubSectionType: Lines (0xF2)
62 .file "trailing_inlined_function.3a6e73a087a7434a-cgu.0"
67 .section .text,"xr",one_only,add_numbers
73 .cv_file 1 "C:\\llvm\\trailing-inlined-function.rs" "A63E3A719BDF505386FDB73BF86EC58591BDAC588181F0E423E724AEEC3E4852" 3
80 .cv_file 2 "/rustc/bc28abf92efc32f8f9312851bf8af38fbd23be42\\library\\core\\src\\option.rs" "7B702FA8D5AAEDC0CCA1EE32F30D5922BC11516B54D592279493A30457F918D9" 3
81 .cv_inline_site_id 1 within 0 inlined_at 1 3 0
86 .cv_inline_site_id 2 within 0 inlined_at 1 4 0
102 leaq __unnamed_1
(%rip
), %rcx
103 leaq __unnamed_2
(%rip
), %r8
106 callq _ZN4core9panicking5panic17hd083df7b722701afE
111 leaq __unnamed_1
(%rip
), %rcx
112 leaq __unnamed_3
(%rip
), %r8
115 callq _ZN4core9panicking5panic17hd083df7b722701afE
121 .section .rdata,"dr",one_only,__unnamed_1
123 .ascii "called `Option::unwrap()` on a `None` value"
125 .section .rdata,"dr",one_only,__unnamed_4
127 .ascii "trailing-inlined-function.rs"
129 .section .rdata,"dr",one_only,__unnamed_2
133 .asciz "\034\000\000\000\000\000\000\000\003\000\000\000\020\000\000"
135 .section .rdata,"dr",one_only,__unnamed_3
139 .asciz "\034\000\000\000\000\000\000\000\004\000\000\000\020\000\000"
141 .section .debug$S,"dr"
145 .long .Ltmp11-.Ltmp10
147 .short .Ltmp13-.Ltmp12
154 .short .Ltmp15-.Ltmp14
167 .asciz "clang LLVM (rustc version 1.73.0-beta.3 (bc28abf92 2023-08-27))"
173 .long .Ltmp17-.Ltmp16
179 .cv_filechecksumoffset 2
184 .cv_filechecksumoffset 2
188 .section .debug$S,"dr",associative,add_numbers
192 .long .Ltmp19-.Ltmp18
194 .short .Ltmp21-.Ltmp20
200 .long .Lfunc_end0-add_numbers
204 .secrel32 add_numbers
207 .asciz "trailing_inlined_function::add_numbers"
210 .short .Ltmp23-.Ltmp22
222 .short .Ltmp25-.Ltmp24
228 .cv_inline_linetable 1 2 932 .Lfunc_begin0 .Lfunc_end0
233 .short .Ltmp27-.Ltmp26
239 .cv_inline_linetable 2 2 932 .Lfunc_begin0 .Lfunc_end0
248 .cv_linetable 0, add_numbers, .Lfunc_end0
249 .section .debug$S,"dr"
253 .long .Ltmp29-.Ltmp28
255 .short .Ltmp31-.Ltmp30
263 .section .debug$T,"dr"
269 .asciz "core::option::Option"
292 .asciz "trailing_inlined_function"
307 .asciz "trailing-inlined-function.rs\\@\\trailing_inlined_function.3a6e73a087a7434a-cgu.0"