1 ; RUN: opt < %s -always-inline -S | FileCheck %s
3 ; Test that the debug location is preserved when rewriting an inlined call as an invoke
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]])
12 declare i32 @__gxx_personality_v0(...)
14 attributes #0 = { alwaysinline }
15 define void @inl() #0 {
16 call void @test(), !dbg !3
20 define void @caller() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
22 to label %cont unwind label %lpad, !dbg !4
28 landingpad { i8*, i32 }
33 !llvm.module.flags = !{!1}
36 !1 = !{i32 2, !"Debug Info Version", i32 3}
37 !2 = distinct !DISubprogram(unit: !5)
38 !3 = !DILocation(line: 1, scope: !2)
39 !4 = !DILocation(line: 2, scope: !2)
40 !5 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
42 isOptimized: true, flags: "-O2",
43 splitDebugFilename: "abc.debug", emissionKind: 2)
44 !6 = !DIFile(filename: "path/davidino", directory: "/path/to/dir")