1 ; Check that debug intrinsics do not affect code generation.
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck --check-prefix=X86-CHECK %s
5 define i64 @simulate(<2 x i32> %a) {
7 %rand = tail call i64 @lrand48()
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
18 %c = bitcast <2 x i32> %add to i64
19 %res = add i64 %rand, %c
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
30 define i64 @simulateWithDebugIntrinsic(<2 x i32> %a) local_unnamed_addr {
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
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
44 %c = bitcast <2 x i32> %add to i64
45 %res = add i64 %rand, %c
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
56 define i64 @simulateWithDbgDeclare(<2 x i32> %a) local_unnamed_addr {
58 %rand = tail call i64 @lrand48() #3
59 tail call void @llvm.dbg.declare(metadata i64 %rand, metadata !6, metadata !7), !dbg !8
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
70 %c = bitcast <2 x i32> %add to i64
71 %res = add i64 %rand, %c
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
82 declare i64 @lrand48()
84 declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
85 declare void @llvm.dbg.declare(metadata, metadata, metadata)
88 !llvm.module.flags = !{!3, !4}
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)
97 !8 = !DILocation(line: 132, column: 2, scope: !5)