1 ; RUN: opt -strip-debug -passes=scalarizer -S < %s | FileCheck %s
2 ; RUN: opt -passes=scalarizer -S < %s | FileCheck %s
4 ; This input caused the scalarizer to violate a debug info
5 ; invariance by using the wrong insertion point.
7 ; CHECK: %0 = load <8 x i16>
9 ; CHECK: %.i0 = extractelement <8 x i16> %0, i64 0
10 ; CHECK-NEXT: %.i01 = add i16 %.i0, 28690
11 ; CHECK: %.i1 = extractelement <8 x i16> %0, i64 1
12 ; CHECK-NEXT: %.i12 = add i16 %.i1, 28690
13 ; CHECK: %.i2 = extractelement <8 x i16> %0, i64 2
14 ; CHECK-NEXT: %.i23 = add i16 %.i2, 28690
15 ; CHECK: %.i3 = extractelement <8 x i16> %0, i64 3
16 ; CHECK-NEXT: %.i34 = add i16 %.i3, 28690
17 ; CHECK: %.i4 = extractelement <8 x i16> %0, i64 4
18 ; CHECK-NEXT: %.i45 = add i16 %.i4, 28690
19 ; CHECK: %.i5 = extractelement <8 x i16> %0, i64 5
20 ; CHECK-NEXT: %.i56 = add i16 %.i5, 28690
21 ; CHECK: %.i6 = extractelement <8 x i16> %0, i64 6
22 ; CHECK-NEXT: %.i67 = add i16 %.i6, 28690
23 ; CHECK: %.i7 = extractelement <8 x i16> %0, i64 7
24 ; CHECK-NEXT: = add i16 %.i7, 28690
26 @d = external global [8 x i16], align 1
27 @e = external global i16, align 1
29 ; Function Attrs: nofree norecurse nounwind
30 define dso_local void @foo() local_unnamed_addr #0 !dbg !7 {
32 %0 = load <8 x i16>, ptr @d, align 1
33 call void @llvm.dbg.value(metadata i16 0, metadata !11, metadata !DIExpression()), !dbg !13
34 %1 = add <8 x i16> %0, <i16 28690, i16 28690, i16 28690, i16 28690, i16 28690, i16 28690, i16 28690, i16 28690>, !dbg !13
35 store <8 x i16> %1, ptr @d, align 1, !dbg !13
36 %2 = extractelement <8 x i16> %1, i32 7, !dbg !13
37 store i16 %2, ptr @e, align 1, !dbg !13
41 ; Function Attrs: nounwind readnone speculatable willreturn
42 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
44 attributes #0 = { nofree norecurse nounwind }
45 attributes #1 = { nounwind readnone speculatable willreturn }
48 !llvm.module.flags = !{!3, !4, !5}
51 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
52 !1 = !DIFile(filename: "foo.c", directory: "/")
54 !3 = !{i32 7, !"Dwarf Version", i32 4}
55 !4 = !{i32 2, !"Debug Info Version", i32 3}
56 !5 = !{i32 1, !"wchar_size", i32 1}
57 !6 = !{!"clang version 11.0.0 "}
58 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !8, scopeLine: 4, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
59 !8 = !DISubroutineType(types: !9)
62 !11 = !DILocalVariable(name: "i", scope: !7, file: !1, line: 5, type: !12)
63 !12 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
64 !13 = !DILocation(line: 0, scope: !7)