68237d89c2c221b9c89abf4128849a4a4ad6977a
[oota-llvm.git] / test / DebugInfo / X86 / inline-seldag-test.ll
1 ; RUN: llc -mtriple=x86_64-linux-gnu -fast-isel=false -filetype=obj < %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
2 ; RUN: llc -mtriple=x86_64-linux-gnu -fast-isel=false -filetype=asm < %s -o - | FileCheck --check-prefix=ASM %s
3
4 ; Generated from:
5 ; clang-tot -c -S -emit-llvm -g inline-seldag-test.c
6 ; inline int __attribute__((always_inline)) f(int y) {
7 ;   return y ? 4 : 7;
8 ; }
9 ; void func() {
10 ;   volatile int x;
11 ;   x = f(x);
12 ; }
13
14 ; CHECK: DW_TAG_inlined_subroutine
15 ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "f"
16
17
18 ; Make sure the condition test is attributed to the inline function, not the
19 ; location of the test's operands within the caller.
20
21 ; ASM: # inline-seldag-test.c:2:0
22 ; ASM-NOT: .loc
23 ; ASM: testl
24
25 ; Function Attrs: nounwind uwtable
26 define void @func() #0 {
27 entry:
28   %y.addr.i = alloca i32, align 4
29   %x = alloca i32, align 4
30   call void @llvm.dbg.declare(metadata i32* %x, metadata !15, metadata !{!"0x102"}), !dbg !17
31   %0 = load volatile i32* %x, align 4, !dbg !18
32   store i32 %0, i32* %y.addr.i, align 4
33   call void @llvm.dbg.declare(metadata i32* %y.addr.i, metadata !19, metadata !{!"0x102"}), !dbg !20
34   %1 = load i32* %y.addr.i, align 4, !dbg !21
35   %tobool.i = icmp ne i32 %1, 0, !dbg !21
36   %cond.i = select i1 %tobool.i, i32 4, i32 7, !dbg !21
37   store volatile i32 %cond.i, i32* %x, align 4, !dbg !18
38   ret void, !dbg !22
39 }
40
41 ; Function Attrs: nounwind readnone
42 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
43
44 attributes #0 = { nounwind uwtable "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" "unsafe-fp-math"="false" "use-soft-float"="false" }
45 attributes #1 = { nounwind readnone }
46
47 !llvm.dbg.cu = !{!0}
48 !llvm.module.flags = !{!12, !13}
49 !llvm.ident = !{!14}
50
51 !0 = !{!"0x11\0012\00clang version 3.5.0 \000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/inline-seldag-test.c] [DW_LANG_C99]
52 !1 = !{!"inline-seldag-test.c", !"/tmp/dbginfo"}
53 !2 = !{}
54 !3 = !{!4, !8}
55 !4 = !{!"0x2e\00func\00func\00\004\000\001\000\006\000\000\004", !1, !5, !6, null, void ()* @func, null, null, !2} ; [ DW_TAG_subprogram ] [line 4] [def] [func]
56 !5 = !{!"0x29", !1}          ; [ DW_TAG_file_type ] [/tmp/dbginfo/inline-seldag-test.c]
57 !6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
58 !7 = !{null}
59 !8 = !{!"0x2e\00f\00f\00\001\000\001\000\006\00256\000\001", !1, !5, !9, null, null, null, null, !2} ; [ DW_TAG_subprogram ] [line 1] [def] [f]
60 !9 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !10, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
61 !10 = !{!11, !11}
62 !11 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
63 !12 = !{i32 2, !"Dwarf Version", i32 4}
64 !13 = !{i32 1, !"Debug Info Version", i32 2}
65 !14 = !{!"clang version 3.5.0 "}
66 !15 = !{!"0x100\00x\005\000", !4, !5, !16} ; [ DW_TAG_auto_variable ] [x] [line 5]
67 !16 = !{!"0x35\00\000\000\000\000\000", null, null, !11} ; [ DW_TAG_volatile_type ] [line 0, size 0, align 0, offset 0] [from int]
68 !17 = !{i32 5, i32 0, !4, null}
69 !18 = !{i32 6, i32 7, !4, null}
70 !19 = !{!"0x101\00y\0016777217\000", !8, !5, !11} ; [ DW_TAG_arg_variable ] [y] [line 1]
71 !20 = !{i32 1, i32 0, !8, !18}
72 !21 = !{i32 2, i32 0, !8, !18}
73 !22 = !{i32 7, i32 0, !4, null}