summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-02-02 19:22:34 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-02-02 19:22:34 +0000
commitc9911f28e5a8060a439aa475e0a95793b1b1e970 (patch)
tree1292f7b899d8f09ff4c194fea492b3b7ff8ecd6c /llvm/test
parente5737f7cacd925aabc3b0d079928d43a4dfdc4a3 (diff)
downloadbcm5719-llvm-c9911f28e5a8060a439aa475e0a95793b1b1e970.tar.gz
bcm5719-llvm-c9911f28e5a8060a439aa475e0a95793b1b1e970.zip
[codeview] Correctly handle inlining functions post-dominated by unreachable
CodeView requires us to accurately describe the extent of the inlined code. We did this by grabbing the next debug location in source order and using *that* to denote where we stopped inlining. However, this is not sufficient or correct in instances where there is no next debug location or the next debug location belongs to the start of another function. To get this correct, use the end symbol of the function to denote the last possible place the inlining could have stopped at. llvm-svn: 259548
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/DebugInfo/COFF/inlining.ll4
-rw-r--r--llvm/test/MC/COFF/cv-inline-linetable-unreachable.s97
-rw-r--r--llvm/test/MC/COFF/cv-inline-linetable.s4
3 files changed, 101 insertions, 4 deletions
diff --git a/llvm/test/DebugInfo/COFF/inlining.ll b/llvm/test/DebugInfo/COFF/inlining.ll
index fafc224022e..6f5650a3ad4 100644
--- a/llvm/test/DebugInfo/COFF/inlining.ll
+++ b/llvm/test/DebugInfo/COFF/inlining.ll
@@ -56,10 +56,10 @@
; ASM: .long Ltmp3-Ltmp2
; ASM: .short 4429
; ASM: .asciz
-; ASM: .cv_inline_linetable 1 1 8 Lfunc_begin0 contains 2
+; ASM: .cv_inline_linetable 1 1 8 Lfunc_begin0 Lfunc_end0 contains 2
; ASM: .short 4429
; ASM: .asciz
-; ASM: .cv_inline_linetable 2 1 2 Lfunc_begin0
+; ASM: .cv_inline_linetable 2 1 2 Lfunc_begin0 Lfunc_end0
; ASM: .short 4430
; ASM: .short 4430
diff --git a/llvm/test/MC/COFF/cv-inline-linetable-unreachable.s b/llvm/test/MC/COFF/cv-inline-linetable-unreachable.s
new file mode 100644
index 00000000000..eb89dd51927
--- /dev/null
+++ b/llvm/test/MC/COFF/cv-inline-linetable-unreachable.s
@@ -0,0 +1,97 @@
+# RUN: llvm-mc -triple=i686-pc-win32 -filetype=obj < %s | llvm-readobj -codeview | FileCheck %s
+ .text
+ .def @feat.00;
+ .scl 3;
+ .type 0;
+ .endef
+ .globl @feat.00
+@feat.00 = 1
+ .def _g;
+ .scl 2;
+ .type 32;
+ .endef
+ .globl _g
+ .p2align 4, 0x90
+_g: # @g
+Lfunc_begin0:
+ .cv_file 1 "\\usr\\local\\google\\home\\majnemer\\llvm\\src\\<stdin>"
+ .cv_loc 0 1 7 0 is_stmt 0 # <stdin>:7:0
+# BB#0: # %entry
+ pushl %ebp
+ movl %esp, %ebp
+ .cv_loc 1 1 4 3 # <stdin>:4:3
+ movl _x, %eax
+ addl $1, %eax
+ movl %eax, _x
+Lfunc_end0:
+
+ .comm _x,4,2 # @x
+ .section .debug$T,"dr"
+ .long 4
+ .short 6
+ .short 4609
+ .long 0
+ .short 14
+ .short 4104
+ .asciz "\003\000\000\000\000\000\000\000\000\020\000"
+ .short 12
+ .short 5633
+ .asciz "\000\000\000\000\001\020\000"
+ .byte 103
+ .byte 0
+ .short 12
+ .short 5633
+ .asciz "\000\000\000\000\001\020\000"
+ .byte 102
+ .byte 0
+ .section .debug$S,"dr"
+ .long 4
+ .long 246 # Inlinee lines subsection
+ .long Ltmp1-Ltmp0
+Ltmp0:
+ .long 0
+ .long 4099 # Inlined function f starts at <stdin>:3
+ .long 0
+ .long 3
+Ltmp1:
+ .long 241 # Symbol subsection for g
+ .long Ltmp3-Ltmp2
+Ltmp2:
+ .short Ltmp5-Ltmp4
+Ltmp4:
+ .short 4423
+ .zero 12
+ .long Lfunc_end0-_g
+ .zero 12
+ .secrel32 _g
+ .secidx _g
+ .byte 0
+ .byte 103
+ .byte 0
+Ltmp5:
+ .short Ltmp7-Ltmp6
+Ltmp6:
+ .short 4429
+ .asciz "\000\000\000\000\000\000\000\000\003\020\000"
+ .cv_inline_linetable 1 1 3 Lfunc_begin0 Lfunc_end0
+# CHECK: InlineSite {
+# CHECK: PtrParent: 0x0
+# CHECK: PtrEnd: 0x0
+# CHECK: Inlinee: f (0x1003)
+# CHECK: BinaryAnnotations [
+# CHECK: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x3, LineOffset: 1}
+# CHECK: ChangeCodeLength: 0xD
+# CHECK: ]
+# CHECK: }
+Ltmp7:
+ .short 2
+ .short 4430
+# CHECK: InlineSiteEnd {
+# CHECK: }
+ .short 2
+ .short 4431
+Ltmp3:
+ .p2align 2
+ .cv_linetable 0, _g, Lfunc_end0
+ .cv_filechecksums # File index to string table offset subsection
+ .cv_stringtable # String table
diff --git a/llvm/test/MC/COFF/cv-inline-linetable.s b/llvm/test/MC/COFF/cv-inline-linetable.s
index 222a0859db5..22aa48f8bc8 100644
--- a/llvm/test/MC/COFF/cv-inline-linetable.s
+++ b/llvm/test/MC/COFF/cv-inline-linetable.s
@@ -84,7 +84,7 @@ Ltmp3:
Ltmp4:
.short 4429
.asciz "\000\000\000\000\000\000\000\000\003\020\000"
- .cv_inline_linetable 1 1 9 Lfunc_begin0 contains 2
+ .cv_inline_linetable 1 1 9 Lfunc_begin0 Lfunc_end0 contains 2
# CHECK: InlineSite {
# CHECK: PtrParent: 0x0
# CHECK: PtrEnd: 0x0
@@ -105,7 +105,7 @@ Ltmp5:
Ltmp6:
.short 4429
.asciz "\000\000\000\000\000\000\000\000\004\020\000"
- .cv_inline_linetable 2 1 3 Lfunc_begin0
+ .cv_inline_linetable 2 1 3 Lfunc_begin0 Lfunc_end0
# CHECK: InlineSite {
# CHECK: PtrParent: 0x0
# CHECK: PtrEnd: 0x0
OpenPOWER on IntegriCloud