1 ; RUN: opt -passes=sroa -S -o - %s \
2 ; RUN: | FileCheck %s --implicit-check-not="call void @llvm.dbg"
3 ; RUN: opt --try-experimental-debuginfo-iterators -passes=sroa -S -o - %s \
4 ; RUN: | FileCheck %s --implicit-check-not="call void @llvm.dbg"
6 ;; Based on llvm/test/DebugInfo/ARM/sroa-complex.ll
9 ;; void f(_Complex double c) { c = 0; }
10 ;; $ clang test.c -g -O2 -c -Xclang -disable-llvm-passes -S \
11 ;; -emit-llvm -o - --target="thumbv7-apple-unknown"
13 ;; Commented out some parts of the function that are not relevant to the test.
15 ;; Check that a split store gets dbg.assigns fragments. Ensure that only the
16 ;; value-expression gets fragment info; that the address-expression remains
19 ;; dbg.assigns for the split (then promoted) stores.
20 ; CHECK: %c.coerce.fca.0.extract = extractvalue [2 x i64] %c.coerce, 0
21 ; CHECK: %c.coerce.fca.1.extract = extractvalue [2 x i64] %c.coerce, 1
22 ; CHECK: call void @llvm.dbg.value(metadata i64 %c.coerce.fca.0.extract,{{.+}}, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64))
23 ; CHECK: call void @llvm.dbg.value(metadata i64 %c.coerce.fca.1.extract,{{.+}}, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64))
25 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
26 target triple = "armv7-apple-unknown"
28 define dso_local arm_aapcscc void @f([2 x i64] %c.coerce) #0 !dbg !8 {
30 %c = alloca { double, double }, align 8, !DIAssignID !14
31 call void @llvm.dbg.assign(metadata i1 undef, metadata !13, metadata !DIExpression(), metadata !14, metadata ptr %c, metadata !DIExpression()), !dbg !15
32 %0 = bitcast ptr %c to [2 x i64]*
33 store [2 x i64] %c.coerce, [2 x i64]* %0, align 8, !DIAssignID !16
34 call void @llvm.dbg.assign(metadata [2 x i64] %c.coerce, metadata !13, metadata !DIExpression(), metadata !16, metadata [2 x i64]* %0, metadata !DIExpression()), !dbg !15
35 ; --- The rest of this function isn't useful for the test ---
36 ;%c.realp = getelementptr inbounds { double, double }, ptr %c, i32 0, i32 0, !dbg !17
37 ;%c.imagp = getelementptr inbounds { double, double }, ptr %c, i32 0, i32 1, !dbg !17
38 ;store double 0.000000e+00, ptr %c.realp, align 8, !dbg !17, !DIAssignID !18
39 ;call void @llvm.dbg.assign(metadata double 0.000000e+00, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64), metadata !18, metadata ptr %c.realp, metadata !DIExpression()), !dbg !15
40 ;store double 0.000000e+00, ptr %c.imagp, align 8, !dbg !17, !DIAssignID !19
41 ;call void @llvm.dbg.assign(metadata double 0.000000e+00, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64), metadata !19, metadata ptr %c.imagp, metadata !DIExpression()), !dbg !15
45 declare void @llvm.dbg.declare(metadata, metadata, metadata)
46 declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)
49 !llvm.module.flags = !{!3, !4, !5, !6, !1000}
52 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
53 !1 = !DIFile(filename: "test.c", directory: "/")
55 !3 = !{i32 7, !"Dwarf Version", i32 4}
56 !4 = !{i32 2, !"Debug Info Version", i32 3}
57 !5 = !{i32 1, !"wchar_size", i32 4}
58 !6 = !{i32 1, !"min_enum_size", i32 4}
59 !7 = !{!"clang version 12.0.0"}
60 !8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !9, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
61 !9 = !DISubroutineType(types: !10)
63 !11 = !DIBasicType(name: "complex", size: 128, encoding: DW_ATE_complex_float)
65 !13 = !DILocalVariable(name: "c", arg: 1, scope: !8, file: !1, line: 2, type: !11)
66 !14 = distinct !DIAssignID()
67 !15 = !DILocation(line: 0, scope: !8)
68 !16 = distinct !DIAssignID()
69 !17 = !DILocation(line: 2, column: 31, scope: !8)
70 !18 = distinct !DIAssignID()
71 !19 = distinct !DIAssignID()
72 !20 = !DILocation(line: 2, column: 36, scope: !8)
73 !1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}