1 ; Check that debug intrinsics do not affect code generation. 2 3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck --check-prefix=X86-CHECK %s 4 5 define i64 @simulate(<2 x i32> %a) { 6 entry: 7 %rand = tail call i64 @lrand48() 8 br label %body 9 10 body: ; preds = %body, %entry 11 %0 = phi <2 x i32> [ %add, %body ], [ zeroinitializer, %entry ] 12 %add = add <2 x i32> %0, %a 13 %rand1 = tail call i64 @lrand48() #3 14 %cmp = icmp eq i64 %rand1, 0 15 br i1 %cmp, label %end, label %body 16 17 end: ; preds = %body 18 %c = bitcast <2 x i32> %add to i64 19 %res = add i64 %rand, %c 20 ret i64 %res 21 } 22 23 ; X86-CHECK: simulate: 24 ; X86-CHECK: movdqa %xmm0, 16(%rsp) 25 ; X86-CHECK: pxor %xmm0, %xmm0 26 ; X86-CHECK: movdqa %xmm0, (%rsp) 27 ; X86-CHECK: callq lrand48 28 ; X86-CHECK: movq %rax, %rbx 29 30 define i64 @simulateWithDebugIntrinsic(<2 x i32> %a) local_unnamed_addr { 31 entry: 32 %rand = tail call i64 @lrand48() #3 33 tail call void @llvm.dbg.value(metadata i64 %rand, i64 0, metadata !6, metadata !7), !dbg !8 34 br label %body 35 36 body: ; preds = %body, %entry 37 %0 = phi <2 x i32> [ %add, %body ], [ zeroinitializer, %entry ] 38 %add = add <2 x i32> %0, %a 39 %rand1 = tail call i64 @lrand48() #3 40 %cmp = icmp eq i64 %rand1, 0 41 br i1 %cmp, label %end, label %body 42 43 end: ; preds = %body 44 %c = bitcast <2 x i32> %add to i64 45 %res = add i64 %rand, %c 46 ret i64 %res 47 } 48 49 ; X86-CHECK: simulateWithDebugIntrinsic: 50 ; X86-CHECK: movdqa %xmm0, 16(%rsp) 51 ; X86-CHECK: pxor %xmm0, %xmm0 52 ; X86-CHECK: movdqa %xmm0, (%rsp) 53 ; X86-CHECK: callq lrand48 54 ; X86-CHECK: movq %rax, %rbx 55 56 define i64 @simulateWithDbgDeclare(<2 x i32> %a) local_unnamed_addr { 57 entry: 58 %rand = tail call i64 @lrand48() #3 59 tail call void @llvm.dbg.declare(metadata i64 %rand, metadata !6, metadata !7), !dbg !8 60 br label %body 61 62 body: ; preds = %body, %entry 63 %0 = phi <2 x i32> [ %add, %body ], [ zeroinitializer, %entry ] 64 %add = add <2 x i32> %0, %a 65 %rand1 = tail call i64 @lrand48() #3 66 %cmp = icmp eq i64 %rand1, 0 67 br i1 %cmp, label %end, label %body 68 69 end: ; preds = %body 70 %c = bitcast <2 x i32> %add to i64 71 %res = add i64 %rand, %c 72 ret i64 %res 73 } 74 75 ; X86-CHECK: simulateWithDbgDeclare: 76 ; X86-CHECK: movdqa %xmm0, 16(%rsp) 77 ; X86-CHECK: pxor %xmm0, %xmm0 78 ; X86-CHECK: movdqa %xmm0, (%rsp) 79 ; X86-CHECK: callq lrand48 80 ; X86-CHECK: movq %rax, %rbx 81 82 declare i64 @lrand48() 83 84 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 85 declare void @llvm.dbg.declare(metadata, metadata, metadata) 86 87 !llvm.dbg.cu = !{!1} 88 !llvm.module.flags = !{!3, !4} 89 90 !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, runtimeVersion: 0, emissionKind: FullDebug) 91 !2 = !DIFile(filename: "test.ll", directory: ".") 92 !3 = !{i32 2, !"Dwarf Version", i32 4} 93 !4 = !{i32 2, !"Debug Info Version", i32 3} 94 !5 = distinct !DISubprogram(name: "simulateWithDebugIntrinsic", scope: !2, file: !2, line: 64, isLocal: false, isDefinition: true, scopeLine: 65, unit: !1) 95 !6 = !DILocalVariable(name: "randv", scope: !5, file: !2, line: 69) 96 !7 = !DIExpression() 97 !8 = !DILocation(line: 132, column: 2, scope: !5) 98