1 ; Test ensuring debug intrinsics do not affect generated function prologue.
3 ; RUN: llc -O1 -mtriple=x86_64-unknown-unknown -o - %s | FileCheck %s
5 @a = local_unnamed_addr global i64 0, align 8
7 define void @noDebug() {
9 %0 = load i64, i64* @a, align 8
10 %1 = load i64, i64* @a, align 8
11 %2 = load i64, i64* @a, align 8
12 %3 = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %0, i64 %1)
13 %4 = extractvalue { i64, i1 } %3, 0
14 %5 = tail call i64 @fn1(i64 %4, i64 %2)
15 tail call void (...) @printf()
16 tail call void (...) @printf(i64 1, i64 2, i64 3, i64 4, i32 0, i64 0, i64 %4, i64 %5)
20 ; CHECK-LABEL: noDebug
21 ; CHECK: addq $24, %rsp
22 ; CHECK-NEXT: .cfi_adjust_cfa_offset -24
23 ; CHECK-NEXT: popq %rbx
24 ; CHECK-NEXT: .cfi_def_cfa_offset 16
25 ; CHECK-NEXT: popq %r14
26 ; CHECK-NEXT: .cfi_def_cfa_offset 8
29 define void @withDebug() !dbg !18 {
31 %0 = load i64, i64* @a, align 8
32 %1 = load i64, i64* @a, align 8
33 %2 = load i64, i64* @a, align 8
34 %3 = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %0, i64 %1)
35 %4 = extractvalue { i64, i1 } %3, 0
36 %5 = tail call i64 @fn1(i64 %4, i64 %2)
37 tail call void @llvm.dbg.value(metadata i64 %4, i64 0, metadata !23, metadata !33), !dbg !34
38 tail call void @llvm.dbg.value(metadata i64 %5, i64 0, metadata !22, metadata !33), !dbg !35
39 tail call void (...) @printf()
40 tail call void (...) @printf(i64 1, i64 2, i64 3, i64 4, i32 0, i64 0, i64 %4, i64 %5)
44 ; CHECK-LABEL: withDebug
47 ; CHECK-NEXT: addq $24, %rsp
48 ; CHECK-NEXT: .cfi_adjust_cfa_offset -24
49 ; CHECK-NEXT: popq %rbx
50 ; CHECK-NEXT: .cfi_def_cfa_offset 16
51 ; CHECK-NEXT: popq %r14
52 ; CHECK-NEXT: .cfi_def_cfa_offset 8
55 declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64)
56 declare i64 @fn1(i64, i64)
58 declare void @printf(...)
60 declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
64 !llvm.module.flags = !{!15, !16}
66 !1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 4.0.0")
67 !2 = !DIFile(filename: "test.cpp", directory: "")
68 !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
69 !15 = !{i32 2, !"Dwarf Version", i32 4}
70 !16 = !{i32 2, !"Debug Info Version", i32 3}
71 !18 = distinct !DISubprogram(name: "test", scope: !2, file: !2, line: 5, unit: !1)
72 !22 = !DILocalVariable(name: "i", scope: !18, file: !2, line: 6, type: !11)
73 !23 = !DILocalVariable(name: "j", scope: !18, file: !2, line: 7, type: !11)
75 !34 = !DILocation(line: 7, column: 17, scope: !18)
76 !35 = !DILocation(line: 6, column: 8, scope: !18)
77 !36 = !DILocation(line: 9, column: 3, scope: !18)
78 !37 = !DILocation(line: 10, column: 10, scope: !18)