xref: /llvm-project/llvm/test/DebugInfo/Mips/dw_op_entry_value_64bit.ll (revision 1575583f2ad9c8f519ea96e44b900a62493cf7bf)
1;; Test mips64:
2; RUN: llc -emit-call-site-info -stop-after=livedebugvalues -mtriple=mips64-linux-gnu -o - %s | FileCheck %s --check-prefix=CHECK64
3; RUN: llc -force-instr-ref-livedebugvalues=1 -emit-call-site-info -stop-after=livedebugvalues -mtriple=mips64-linux-gnu -o - %s | FileCheck %s --check-prefix=CHECK64
4;; Test mips64el:
5; RUN: llc -emit-call-site-info -stop-after=livedebugvalues -mtriple=mips64el-linux-gnu -o - %s | FileCheck %s --check-prefix=CHECK64el
6; RUN: llc -force-instr-ref-livedebugvalues=1 -emit-call-site-info -stop-after=livedebugvalues -mtriple=mips64el-linux-gnu -o - %s | FileCheck %s --check-prefix=CHECK64el
7
8;; Built from source:
9;; extern long fn1(long,long,long);
10;; long fn2(long a, long b, long c) {
11;;   long local = fn1(a+b, c, b+10);
12;;   if (local > 10)
13;;     return local + 10;
14;;   return b;
15;; }
16;; Using command:
17;; clang -g -O2 -target mips64-linux-gnu m.c -c -S -emit-llvm
18;; Confirm that info from callSites attribute is used as entry_value in DIExpression.
19
20;; Test mips64:
21; CHECK64: $a0_64 = nsw DADDu $a1_64, killed renamable $a0_64,
22; CHECK64-NEXT: DBG_VALUE $a0_64, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1)
23
24;; Test mips64el:
25; CHECK64el: $a0_64 = nsw DADDu $a1_64, killed renamable $a0_64,
26; CHECK64el-NEXT: DBG_VALUE $a0_64, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1)
27
28; ModuleID = 'm.c'
29source_filename = "m.c"
30target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
31target triple = "mips64-unknown-linux-gnu"
32
33; Function Attrs: nounwind
34define i64 @fn2(i64 signext %a, i64 signext %b, i64 signext %c) local_unnamed_addr !dbg !13 {
35entry:
36  call void @llvm.dbg.value(metadata i64 %a, metadata !15, metadata !DIExpression()), !dbg !19
37  call void @llvm.dbg.value(metadata i64 %b, metadata !16, metadata !DIExpression()), !dbg !19
38  call void @llvm.dbg.value(metadata i64 %c, metadata !17, metadata !DIExpression()), !dbg !19
39  %add = add nsw i64 %b, %a, !dbg !19
40  %add1 = add nsw i64 %b, 10, !dbg !19
41  %call = tail call i64 @fn1(i64 signext %add, i64 signext %c, i64 signext %add1), !dbg !19
42  call void @llvm.dbg.value(metadata i64 %call, metadata !18, metadata !DIExpression()), !dbg !19
43  %cmp = icmp sgt i64 %call, 10, !dbg !23
44  %add2 = add nsw i64 %call, 10, !dbg !19
45  %retval.0 = select i1 %cmp, i64 %add2, i64 %b, !dbg !19
46  ret i64 %retval.0, !dbg !19
47}
48
49declare !dbg !4 i64 @fn1(i64 signext, i64 signext, i64 signext) local_unnamed_addr
50
51; Function Attrs: nounwind readnone speculatable willreturn
52declare void @llvm.dbg.value(metadata, metadata, metadata)
53
54!llvm.dbg.cu = !{!0}
55!llvm.module.flags = !{!8, !9, !10, !11}
56!llvm.ident = !{!12}
57
58!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
59!1 = !DIFile(filename: "m.c", directory: "/dir")
60!2 = !{}
61!3 = !{!4}
62!4 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
63!5 = !DISubroutineType(types: !6)
64!6 = !{!7, !7, !7, !7}
65!7 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
66!8 = !{i32 7, !"Dwarf Version", i32 4}
67!9 = !{i32 2, !"Debug Info Version", i32 3}
68!10 = !{i32 1, !"wchar_size", i32 4}
69!11 = !{i32 7, !"PIC Level", i32 1}
70!12 = !{!"clang version 11.0.0"}
71!13 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 2, type: !5, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
72!14 = !{!15, !16, !17, !18}
73!15 = !DILocalVariable(name: "a", arg: 1, scope: !13, file: !1, line: 2, type: !7)
74!16 = !DILocalVariable(name: "b", arg: 2, scope: !13, file: !1, line: 2, type: !7)
75!17 = !DILocalVariable(name: "c", arg: 3, scope: !13, file: !1, line: 2, type: !7)
76!18 = !DILocalVariable(name: "local", scope: !13, file: !1, line: 3, type: !7)
77!19 = !DILocation(line: 0, scope: !13)
78!23 = !DILocation(line: 4, column: 13, scope: !24)
79!24 = distinct !DILexicalBlock(scope: !13, file: !1, line: 4, column: 7)
80