Florian Hahn | 7582c66 | 2016-12-06 10:24:55 +0000 | [diff] [blame^] | 1 | ; Test ensuring debug intrinsics do not affect generated function prologue. |
| 2 | ; |
| 3 | ; RUN: llc -O1 -mtriple=x86_64-unknown-unknown -o - %s | FileCheck %s |
| 4 | |
| 5 | |
| 6 | define i64 @noDebug(i64 %a) { |
| 7 | %call = call i64 @fn(i64 %a, i64 0) |
| 8 | ret i64 %call |
| 9 | } |
| 10 | |
| 11 | ; CHECK-LABEL: noDebug |
| 12 | ; CHECK: popq %rcx |
| 13 | ; CHECK: ret |
| 14 | |
| 15 | |
| 16 | define i64 @withDebug(i64 %a) !dbg !4 { |
| 17 | %call = call i64 @fn(i64 %a, i64 0) |
| 18 | tail call void @llvm.dbg.value(metadata i64 %call, i64 0, metadata !5, metadata !6), !dbg !7 |
| 19 | ret i64 %call |
| 20 | } |
| 21 | |
| 22 | ; CHECK-LABEL: withDebug |
| 23 | ; CHECK: popq %rcx |
| 24 | ; CHECK: ret |
| 25 | |
| 26 | |
| 27 | declare i64 @fn(i64, i64) |
| 28 | |
| 29 | declare void @llvm.dbg.value(metadata, i64, metadata, metadata) |
| 30 | |
| 31 | !llvm.dbg.cu = !{!0} |
| 32 | !llvm.module.flags = !{!2,!3} |
| 33 | |
| 34 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0") |
| 35 | !1 = !DIFile(filename: "test.c", directory: "/") |
| 36 | !2 = !{i32 2, !"Dwarf Version", i32 4} |
| 37 | !3 = !{i32 2, !"Debug Info Version", i32 3} |
| 38 | !4 = distinct !DISubprogram(name: "withDebug", unit: !0) |
| 39 | !5 = !DILocalVariable(name: "w", scope: !4) |
| 40 | !6 = !DIExpression() |
| 41 | !7 = !DILocation(line: 210, column: 12, scope: !4) |