• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Check that debug intrinsics do not affect code generation.
2
3; RUN: llc < %s -mtriple=aarch64-unknown-unknown -mattr=+avx | FileCheck --check-prefix=AARCH64-CHECK %s
4
5define i64 @simulate(<2 x i32> %a) {
6entry:
7  %rand = tail call i64 @lrand48()
8  br label %body
9
10body:                                        ; 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
17end:                                        ; preds = %body
18  %c = bitcast <2 x i32> %add to i64
19  %res = add i64 %rand, %c
20  ret i64 %res
21}
22
23; AARCH64-CHECK: simulate:
24; AARCH64-CHECK: movi d9, #0000000000000000
25; AARCH64-CHECK: bl lrand48
26; AARCH64-CHECK: mov x19, x0
27; AARCH64-CHECK: BB0_1:
28
29
30define i64 @simulateWithDebugIntrinsic(<2 x i32> %a) local_unnamed_addr  {
31entry:
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
36body:                                        ; 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
43end:                                        ; preds = %body
44  %c = bitcast <2 x i32> %add to i64
45  %res = add i64 %rand, %c
46  ret i64 %res
47}
48
49; AARCH64-CHECK: simulateWithDebugIntrinsic
50; AARCH64-CHECK: movi d9, #0000000000000000
51; AARCH64-CHECK: bl lrand48
52; AARCH64-CHECK: mov x19, x0
53; AARCH64-CHECK: BB1_1:
54
55
56define i64 @simulateWithDbgDeclare(<2 x i32> %a) local_unnamed_addr  {
57entry:
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
62body:                                        ; 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
69end:                                        ; preds = %body
70  %c = bitcast <2 x i32> %add to i64
71  %res = add i64 %rand, %c
72  ret i64 %res
73}
74
75; AARCH64-CHECK: simulateWithDbgDeclare:
76; AARCH64-CHECK: movi d9, #0000000000000000
77; AARCH64-CHECK: bl lrand48
78; AARCH64-CHECK: mov x19, x0
79; AARCH64-CHECK: BB2_1:
80
81declare i64 @lrand48()
82
83declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
84declare void @llvm.dbg.declare(metadata, metadata, metadata)
85
86!llvm.dbg.cu = !{!1}
87!llvm.module.flags = !{!3, !4}
88
89!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, runtimeVersion: 0, emissionKind: FullDebug)
90!2 = !DIFile(filename: "test.ll", directory: ".")
91!3 = !{i32 2, !"Dwarf Version", i32 4}
92!4 = !{i32 2, !"Debug Info Version", i32 3}
93!5 = distinct !DISubprogram(name: "simulateWithDebugIntrinsic", scope: !2, file: !2, line: 64, isLocal: false, isDefinition: true, scopeLine: 65, unit: !1)
94!6 = !DILocalVariable(name: "randv", scope: !5, file: !2, line: 69)
95!7 = !DIExpression()
96!8 = !DILocation(line: 132, column: 2, scope: !5)
97