blob: 4d5145abafe1fb1a244cc86b7b0cd0f08fe5a15e [file] [log] [blame]
Dehao Chen46f8fbb2016-04-14 18:37:18 +00001; RUN: opt < %s -add-discriminators -S | FileCheck %s
Xinliang David Li1eaecef2016-06-15 21:51:30 +00002; RUN: opt < %s -passes=add-discriminators -S | FileCheck %s
Dehao Chen46f8fbb2016-04-14 18:37:18 +00003
4; Discriminator support for calls that are defined in one line:
5; #1 int foo(int, int);
6; #2 int bar();
7; #3 int baz() {
8; #4 return foo(bar(),
9; #5 bar());
10; #6 }
11
12; Function Attrs: uwtable
13define i32 @_Z3bazv() #0 !dbg !4 {
14 %1 = call i32 @_Z3barv(), !dbg !11
15; CHECK: %1 = call i32 @_Z3barv(), !dbg ![[CALL0:[0-9]+]]
16 %2 = call i32 @_Z3barv(), !dbg !12
17; CHECK: %2 = call i32 @_Z3barv(), !dbg ![[CALL1:[0-9]+]]
18 %3 = call i32 @_Z3fooii(i32 %1, i32 %2), !dbg !13
19; CHECK: %3 = call i32 @_Z3fooii(i32 %1, i32 %2), !dbg ![[CALL2:[0-9]+]]
20 ret i32 %3, !dbg !14
21}
22
23declare i32 @_Z3fooii(i32, i32) #1
24
25declare i32 @_Z3barv() #1
26
27attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
28attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
29
30!llvm.dbg.cu = !{!0}
31!llvm.module.flags = !{!8, !9}
32!llvm.ident = !{!10}
33
Adrian Prantl75819ae2016-04-15 15:57:41 +000034!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 266269)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
Dehao Chen46f8fbb2016-04-14 18:37:18 +000035!1 = !DIFile(filename: "test.cc", directory: "")
36!2 = !{}
Adrian Prantl75819ae2016-04-15 15:57:41 +000037!4 = distinct !DISubprogram(name: "baz", linkageName: "_Z3bazv", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
Dehao Chen46f8fbb2016-04-14 18:37:18 +000038!5 = !DISubroutineType(types: !6)
39!6 = !{!7}
40!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
41!8 = !{i32 2, !"Dwarf Version", i32 4}
42!9 = !{i32 2, !"Debug Info Version", i32 3}
43!10 = !{!"clang version 3.9.0 (trunk 266269)"}
44!11 = !DILocation(line: 4, column: 14, scope: !4)
45!12 = !DILocation(line: 5, column: 14, scope: !4)
46!13 = !DILocation(line: 4, column: 10, scope: !4)
47!14 = !DILocation(line: 4, column: 3, scope: !4)
48
49; CHECK: ![[CALL2]] = !DILocation(line: 4, column: 10, scope: ![[CALL2BLOCK:[0-9]+]])
Dehao Chenfb02f712017-02-10 21:09:07 +000050; CHECK: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 2)