| Elena Demikhovsky | 70247a8 | 2013-02-14 08:23:08 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=x86_64-apple-darwin -filetype=obj -O0 < %s > %t |
| Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 2 | ; RUN: llvm-dwarfdump -v %t | FileCheck %s |
| David Blaikie | 9f4b70d | 2013-01-26 21:55:23 +0000 | [diff] [blame] | 3 | |
| David Blaikie | 7c8dbc1 | 2013-03-22 19:13:22 +0000 | [diff] [blame] | 4 | ; CHECK: [[FILEID:[0-9]+]]]{{.*}}list0.h |
| Diego Novillo | 5b5cf50 | 2014-02-14 19:27:53 +0000 | [diff] [blame] | 5 | ; CHECK: [[FILEID]] 0 1 0 0 is_stmt{{$}} |
| David Blaikie | 9f4b70d | 2013-01-26 21:55:23 +0000 | [diff] [blame] | 6 | |
| 7 | ; IR generated from clang -g -emit-llvm with the following source: |
| 8 | ; list0.h: |
| 9 | ; int foo (int x) { |
| 10 | ; return ++x; |
| 11 | ; } |
| 12 | ; list0.c: |
| 13 | ; #include "list0.h" |
| 14 | ; int main() { |
| 15 | ; } |
| 16 | |
| Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 17 | define i32 @foo(i32 %x) #0 !dbg !4 { |
| David Blaikie | 9f4b70d | 2013-01-26 21:55:23 +0000 | [diff] [blame] | 18 | entry: |
| 19 | %x.addr = alloca i32, align 4 |
| 20 | store i32 %x, i32* %x.addr, align 4 |
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 21 | call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !14, metadata !DIExpression()), !dbg !15 |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 22 | %0 = load i32, i32* %x.addr, align 4, !dbg !16 |
| David Blaikie | 9f4b70d | 2013-01-26 21:55:23 +0000 | [diff] [blame] | 23 | %inc = add nsw i32 %0, 1, !dbg !16 |
| 24 | store i32 %inc, i32* %x.addr, align 4, !dbg !16 |
| 25 | ret i32 %inc, !dbg !16 |
| 26 | } |
| 27 | |
| Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 28 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| David Blaikie | 9f4b70d | 2013-01-26 21:55:23 +0000 | [diff] [blame] | 29 | |
| Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 30 | define i32 @main() #0 !dbg !10 { |
| David Blaikie | 9f4b70d | 2013-01-26 21:55:23 +0000 | [diff] [blame] | 31 | entry: |
| 32 | ret i32 0, !dbg !17 |
| 33 | } |
| 34 | |
| David Blaikie | 7c8dbc1 | 2013-03-22 19:13:22 +0000 | [diff] [blame] | 35 | attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 36 | attributes #1 = { nounwind readnone } |
| 37 | |
| David Blaikie | 9f4b70d | 2013-01-26 21:55:23 +0000 | [diff] [blame] | 38 | !llvm.dbg.cu = !{!0} |
| Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 39 | !llvm.module.flags = !{!19} |
| David Blaikie | 9f4b70d | 2013-01-26 21:55:23 +0000 | [diff] [blame] | 40 | |
| Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 41 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) |
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 42 | !1 = !DIFile(filename: "list0.c", directory: "/usr/local/google/home/blaikie/dev/scratch") |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 43 | !2 = !{} |
| Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 44 | !4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !5, scope: !6, type: !7, variables: !2) |
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 45 | !5 = !DIFile(filename: "./list0.h", directory: "/usr/local/google/home/blaikie/dev/scratch") |
| 46 | !6 = !DIFile(filename: "./list0.h", directory: "/usr/local/google/home/blaikie/dev/scratch") |
| 47 | !7 = !DISubroutineType(types: !8) |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 48 | !8 = !{!9, !9} |
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 49 | !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 50 | !10 = distinct !DISubprogram(name: "main", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !11, type: !12, variables: !2) |
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 51 | !11 = !DIFile(filename: "list0.c", directory: "/usr/local/google/home/blaikie/dev/scratch") |
| 52 | !12 = !DISubroutineType(types: !13) |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 53 | !13 = !{!9} |
| Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 54 | !14 = !DILocalVariable(name: "x", line: 1, arg: 1, scope: !4, file: !6, type: !9) |
| Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 55 | !15 = !DILocation(line: 1, scope: !4) |
| 56 | !16 = !DILocation(line: 2, scope: !4) |
| 57 | !17 = !DILocation(line: 3, scope: !18) |
| 58 | !18 = !DILexicalBlockFile(discriminator: 0, file: !11, scope: !10) |
| Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 59 | !19 = !{i32 1, !"Debug Info Version", i32 3} |