1; RUN: opt < %s -always-inline -S | FileCheck %s
2
3; Test that the debug location is preserved when rewriting an inlined call as an invoke
4
5; CHECK: invoke void @test()
6; CHECK-NEXT: to label {{.*}} unwind label {{.*}}, !dbg [[INL_LOC:!.*]]
7; CHECK: [[SP:.*]] = distinct !DISubprogram(
8; CHECK: [[INL_LOC]] = !DILocation(line: 1, scope: [[SP]], inlinedAt: [[INL_AT:.*]])
9; CHECK: [[INL_AT]] = distinct !DILocation(line: 2, scope: [[SP]])
10
11declare void @test()
12declare i32 @__gxx_personality_v0(...)
13
14attributes #0 = { alwaysinline }
15define void @inl() #0 {
16  call void @test(), !dbg !3
17  ret void
18}
19
20define void @caller() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
21  invoke void @inl()
22    to label %cont unwind label %lpad, !dbg !4
23
24cont:
25  ret void
26
27lpad:
28  landingpad { i8*, i32 }
29    cleanup
30  ret void
31}
32
33!llvm.module.flags = !{!1}
34!1 = !{i32 2, !"Debug Info Version", i32 3}
35!2 = distinct !DISubprogram()
36!3 = !DILocation(line: 1, scope: !2)
37!4 = !DILocation(line: 2, scope: !2)
38