xref: /llvm-project/llvm/test/DebugInfo/X86/rematerialize.ll (revision 5e6e545cbab05589c8fcef5f03eca60dc227a6ca)
1; RUN: llc -O2 -filetype=obj -mtriple=x86_64-unknown-linux-gnu < %s \
2; RUN: | llvm-dwarfdump -debug-line - | FileCheck %s
3;
4; Generated with clang -O2 -g from
5;
6; typedef float __m128 __attribute__((__vector_size__(16)));
7;
8; extern __m128 doSomething(__m128, __m128);
9;
10;
11; __m128 foo(__m128 X) {     // line 6
12;   const __m128 V = {0.5f, 0.5f, 0.5f, 0.5f};  // line 7
13;   __m128 Sub = X - V;  // line 8
14;   __m128 Add = X + V;  // line 9
15;
16;   __m128 Result = doSomething(Add, Sub);  // line 11
17;
18;   return V - Result;  // line 13
19; }
20;
21;
22; We want to see line 13 after line 11 without any other line in between.
23; CHECK:       0x{{[0-9a-f]*}} 11
24; CHECK-NOT:   0x{{[0-9a-f]*}}  8
25; CHECK-NOT:   0x{{[0-9a-f]*}}  9
26; CHECK:       0x{{[0-9a-f]*}} 13
27; CHECK-NOT:   0x{{[0-9a-f]*}}  8
28; CHECK-NOT:   0x{{[0-9a-f]*}}  9
29
30; ModuleID = 'test.c'
31source_filename = "test.c"
32; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
33; target triple = "x86_64-unknown-linux-gnu"
34
35; Function Attrs: nounwind uwtable
36define <4 x float> @foo(<4 x float> %X) local_unnamed_addr #0 !dbg !6 {
37entry:
38  tail call void @llvm.dbg.value(metadata <4 x float> %X, metadata !15, metadata !21), !dbg !22
39  tail call void @llvm.dbg.value(metadata <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, metadata !16, metadata !21), !dbg !23
40  %sub = fadd <4 x float> %X, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>, !dbg !24
41  tail call void @llvm.dbg.value(metadata <4 x float> %sub, metadata !18, metadata !21), !dbg !25
42  %add = fadd <4 x float> %X, <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, !dbg !26
43  tail call void @llvm.dbg.value(metadata <4 x float> %add, metadata !19, metadata !21), !dbg !27
44  %call = tail call <4 x float> @doSomething(<4 x float> %add, <4 x float> %sub) #3, !dbg !28
45  tail call void @llvm.dbg.value(metadata <4 x float> %call, metadata !20, metadata !21), !dbg !29
46  %sub1 = fsub <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>, %call, !dbg !30
47  ret <4 x float> %sub1, !dbg !31
48}
49
50declare <4 x float> @doSomething(<4 x float>, <4 x float>) local_unnamed_addr #1
51
52; Function Attrs: nounwind readnone
53declare void @llvm.dbg.value(metadata, metadata, metadata) #2
54
55attributes #0 = { nounwind uwtable }
56attributes #1 = { nounwind uwtable }
57attributes #2 = { nounwind readnone }
58attributes #3 = { nounwind }
59
60!llvm.dbg.cu = !{!0}
61!llvm.module.flags = !{!3, !4}
62!llvm.ident = !{!5}
63
64!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 278291)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
65!1 = !DIFile(filename: "test.c", directory: "/home/test")
66!2 = !{}
67!3 = !{i32 2, !"Dwarf Version", i32 4}
68!4 = !{i32 2, !"Debug Info Version", i32 3}
69!5 = !{!"clang version 4.0.0 (trunk 278291)"}
70!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 6, type: !7, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !14)
71!7 = !DISubroutineType(types: !8)
72!8 = !{!9, !9}
73!9 = !DIDerivedType(tag: DW_TAG_typedef, name: "__m128", file: !1, line: 1, baseType: !10)
74!10 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 128, align: 128, flags: DIFlagVector, elements: !12)
75!11 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float)
76!12 = !{!13}
77!13 = !DISubrange(count: 4)
78!14 = !{!15, !16, !18, !19, !20}
79!15 = !DILocalVariable(name: "X", arg: 1, scope: !6, file: !1, line: 6, type: !9)
80!16 = !DILocalVariable(name: "V", scope: !6, file: !1, line: 7, type: !17)
81!17 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !9)
82!18 = !DILocalVariable(name: "Sub", scope: !6, file: !1, line: 8, type: !9)
83!19 = !DILocalVariable(name: "Add", scope: !6, file: !1, line: 9, type: !9)
84!20 = !DILocalVariable(name: "Result", scope: !6, file: !1, line: 11, type: !9)
85!21 = !DIExpression()
86!22 = !DILocation(line: 6, column: 19, scope: !6)
87!23 = !DILocation(line: 7, column: 16, scope: !6)
88!24 = !DILocation(line: 8, column: 18, scope: !6)
89!25 = !DILocation(line: 8, column: 10, scope: !6)
90!26 = !DILocation(line: 9, column: 18, scope: !6)
91!27 = !DILocation(line: 9, column: 10, scope: !6)
92!28 = !DILocation(line: 11, column: 19, scope: !6)
93!29 = !DILocation(line: 11, column: 10, scope: !6)
94!30 = !DILocation(line: 13, column: 12, scope: !6)
95!31 = !DILocation(line: 13, column: 3, scope: !6)
96