Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -add-discriminators -S | FileCheck %s |
Xinliang David Li | 1eaecef | 2016-06-15 21:51:30 +0000 | [diff] [blame] | 2 | ; RUN: opt < %s -passes=add-discriminators -S | FileCheck %s |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 3 | |
| 4 | ; Discriminator support for calls that are defined in one line: |
| 5 | ; #1 void bar(); |
| 6 | ; #2 |
| 7 | ; #3 void foo() { |
Dehao Chen | fb02f71 | 2017-02-10 21:09:07 +0000 | [diff] [blame] | 8 | ; #4 bar();bar()/*discriminator 2*/;bar()/*discriminator 4*/; |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 9 | ; #5 } |
| 10 | |
| 11 | ; Function Attrs: uwtable |
Pete Cooper | adebb93 | 2016-03-11 02:14:16 +0000 | [diff] [blame] | 12 | define void @_Z3foov() #0 !dbg !4 { |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 13 | call void @_Z3barv(), !dbg !10 |
| 14 | ; CHECK: call void @_Z3barv(), !dbg ![[CALL0:[0-9]+]] |
Dehao Chen | 17c6afc | 2016-08-05 17:56:49 +0000 | [diff] [blame] | 15 | %a = alloca [100 x i8], align 16 |
| 16 | %b = bitcast [100 x i8]* %a to i8* |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 17 | call void @llvm.lifetime.start.p0i8(i64 100, i8* %b), !dbg !11 |
| 18 | call void @llvm.lifetime.end.p0i8(i64 100, i8* %b), !dbg !11 |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 19 | call void @_Z3barv(), !dbg !11 |
| 20 | ; CHECK: call void @_Z3barv(), !dbg ![[CALL1:[0-9]+]] |
| 21 | call void @_Z3barv(), !dbg !12 |
| 22 | ; CHECK: call void @_Z3barv(), !dbg ![[CALL2:[0-9]+]] |
| 23 | ret void, !dbg !13 |
| 24 | } |
| 25 | |
| 26 | declare void @_Z3barv() #1 |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 27 | declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind argmemonly |
| 28 | declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) nounwind argmemonly |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 29 | |
| 30 | attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 31 | attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 32 | |
Adrian Prantl | d1f52b67 | 2016-04-11 16:58:35 +0000 | [diff] [blame] | 33 | !llvm.dbg.cu = !{!0} |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 34 | !llvm.module.flags = !{!7, !8} |
| 35 | !llvm.ident = !{!9} |
| 36 | |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 37 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 250915) (llvm/trunk 251830)", isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 38 | !1 = !DIFile(filename: "c.cc", directory: "/tmp") |
| 39 | !2 = !{} |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 40 | !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 41 | !5 = !DISubroutineType(types: !6) |
| 42 | !6 = !{null} |
| 43 | !7 = !{i32 2, !"Dwarf Version", i32 4} |
| 44 | !8 = !{i32 2, !"Debug Info Version", i32 3} |
| 45 | !9 = !{!"clang version 3.8.0 (trunk 250915) (llvm/trunk 251830)"} |
| 46 | !10 = !DILocation(line: 4, column: 3, scope: !4) |
| 47 | !11 = !DILocation(line: 4, column: 9, scope: !4) |
| 48 | !12 = !DILocation(line: 4, column: 15, scope: !4) |
| 49 | !13 = !DILocation(line: 5, column: 1, scope: !4) |
| 50 | |
| 51 | ; CHECK: ![[CALL1]] = !DILocation(line: 4, column: 9, scope: ![[CALL1BLOCK:[0-9]+]]) |
Dehao Chen | fb02f71 | 2017-02-10 21:09:07 +0000 | [diff] [blame] | 52 | ; CHECK: ![[CALL1BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 2) |
Dehao Chen | 3656e30 | 2015-11-09 17:30:38 +0000 | [diff] [blame] | 53 | ; CHECK: ![[CALL2]] = !DILocation(line: 4, column: 15, scope: ![[CALL2BLOCK:[0-9]+]]) |
Dehao Chen | fb02f71 | 2017-02-10 21:09:07 +0000 | [diff] [blame] | 54 | ; CHECK: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 4) |