| David Blaikie | 644d2ee | 2014-06-30 20:30:39 +0000 | [diff] [blame] | 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:!.*]] | 
| Duncan P. N. Exon Smith | 814b8e9 | 2015-08-28 20:26:49 +0000 | [diff] [blame] | 7 | ; CHECK: [[SP:.*]] = distinct !DISubprogram( | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 8 | ; CHECK: [[INL_LOC]] = !DILocation(line: 1, scope: [[SP]], inlinedAt: [[INL_AT:.*]]) | 
|  | 9 | ; CHECK: [[INL_AT]] = distinct !DILocation(line: 2, scope: [[SP]]) | 
| David Blaikie | 644d2ee | 2014-06-30 20:30:39 +0000 | [diff] [blame] | 10 |  | 
|  | 11 | declare void @test() | 
|  | 12 | declare i32 @__gxx_personality_v0(...) | 
|  | 13 |  | 
|  | 14 | attributes #0 = { alwaysinline } | 
|  | 15 | define void @inl() #0 { | 
|  | 16 | call void @test(), !dbg !3 | 
|  | 17 | ret void | 
|  | 18 | } | 
|  | 19 |  | 
| David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 20 | define void @caller() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { | 
| David Blaikie | 644d2ee | 2014-06-30 20:30:39 +0000 | [diff] [blame] | 21 | invoke void @inl() | 
|  | 22 | to label %cont unwind label %lpad, !dbg !4 | 
|  | 23 |  | 
|  | 24 | cont: | 
|  | 25 | ret void | 
|  | 26 |  | 
|  | 27 | lpad: | 
| David Majnemer | 7fddecc | 2015-06-17 20:52:32 +0000 | [diff] [blame] | 28 | landingpad { i8*, i32 } | 
| David Blaikie | 644d2ee | 2014-06-30 20:30:39 +0000 | [diff] [blame] | 29 | cleanup | 
|  | 30 | ret void | 
|  | 31 | } | 
|  | 32 |  | 
|  | 33 | !llvm.module.flags = !{!1} | 
| Davide Italiano | ea04026 | 2016-04-05 23:37:08 +0000 | [diff] [blame] | 34 | !llvm.dbg.cu = !{!5} | 
|  | 35 |  | 
| Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 36 | !1 = !{i32 2, !"Debug Info Version", i32 3} | 
| Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 37 | !2 = distinct !DISubprogram(unit: !5) | 
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 38 | !3 = !DILocation(line: 1, scope: !2) | 
|  | 39 | !4 = !DILocation(line: 2, scope: !2) | 
| Davide Italiano | ea04026 | 2016-04-05 23:37:08 +0000 | [diff] [blame] | 40 | !5 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", | 
|  | 41 | file: !6, | 
|  | 42 | isOptimized: true, flags: "-O2", | 
| Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 43 | splitDebugFilename: "abc.debug", emissionKind: 2) | 
| Davide Italiano | ea04026 | 2016-04-05 23:37:08 +0000 | [diff] [blame] | 44 | !6 = !DIFile(filename: "path/davidino", directory: "/path/to/dir") |