144 lines · plain
1; REQUIRES: x86-registered-target2; RUN: opt -passes=slp-vectorizer -S -o - %s \3; RUN: | FileCheck %s4 5;; $ cat test.cpp6;; float get();7;; float ext(float*);8;; void fun(float k1, float k2, float k3, float k4) {9;; float quad[4];10;; float c1 = get();11;; float c2 = get();12;; quad[0] = c1 - k1 - k3;13;; quad[1] = c2 - k2 - k4;14;; quad[2] = c1 - k1 + k3;15;; quad[3] = c2 - k2 + k4;16;; ext(quad);17;; }18;;19;; Generated by grabbingthe IR before SLP in:20;; $ clang++ -O2 -g test.cpp -Xclang -fexperimental-assignment-tracking21 22;; Test that dbg.assigns linked to the the scalar stores to quad get linked to23;; the vector store that replaces them.24 25; CHECK: #dbg_assign(float poison, ![[VAR:[0-9]+]], !DIExpression(DW_OP_LLVM_fragment, 0, 32), ![[ID:[0-9]+]], ptr %arrayidx, !DIExpression(),26; CHECK: #dbg_assign(float poison, ![[VAR]], !DIExpression(DW_OP_LLVM_fragment, 32, 32), ![[ID]], ptr %quad, !DIExpression(DW_OP_plus_uconst, 4),27; CHECK: #dbg_assign(float poison, ![[VAR]], !DIExpression(DW_OP_LLVM_fragment, 64, 32), ![[ID]], ptr %quad, !DIExpression(DW_OP_plus_uconst, 8),28; CHECK: store <4 x float> {{.*}} !DIAssignID ![[ID]]29; CHECK: #dbg_assign(float poison, ![[VAR]], !DIExpression(DW_OP_LLVM_fragment, 96, 32), ![[ID]], ptr %quad, !DIExpression(DW_OP_plus_uconst, 12),30 31target triple = "x86_64-unknown-unknown"32 33define dso_local void @_Z3funffff(float %k1, float %k2, float %k3, float %k4) local_unnamed_addr #0 !dbg !7 {34entry:35 %quad = alloca [4 x float], align 16, !DIAssignID !2736 call void @llvm.dbg.assign(metadata i1 undef, metadata !16, metadata !DIExpression(), metadata !27, metadata ptr %quad, metadata !DIExpression()), !dbg !2337 call void @llvm.dbg.assign(metadata float %k1, metadata !12, metadata !DIExpression(), metadata !30, metadata ptr undef, metadata !DIExpression()), !dbg !2338 call void @llvm.dbg.assign(metadata float %k2, metadata !13, metadata !DIExpression(), metadata !31, metadata ptr undef, metadata !DIExpression()), !dbg !2339 call void @llvm.dbg.assign(metadata float %k3, metadata !14, metadata !DIExpression(), metadata !32, metadata ptr undef, metadata !DIExpression()), !dbg !2340 call void @llvm.dbg.assign(metadata float %k4, metadata !15, metadata !DIExpression(), metadata !33, metadata ptr undef, metadata !DIExpression()), !dbg !2341 %call = tail call float @_Z3getv(), !dbg !3542 call void @llvm.dbg.assign(metadata float %call, metadata !20, metadata !DIExpression(), metadata !36, metadata ptr undef, metadata !DIExpression()), !dbg !2343 %call1 = tail call float @_Z3getv(), !dbg !3744 call void @llvm.dbg.assign(metadata float %call1, metadata !21, metadata !DIExpression(), metadata !38, metadata ptr undef, metadata !DIExpression()), !dbg !2345 %sub = fsub float %call, %k1, !dbg !3946 %sub2 = fsub float %sub, %k3, !dbg !4047 %arrayidx = getelementptr inbounds [4 x float], ptr %quad, i64 0, i64 0, !dbg !4148 store float %sub2, ptr %arrayidx, align 16, !dbg !42, !DIAssignID !4749 call void @llvm.dbg.assign(metadata float %sub2, metadata !16, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32), metadata !47, metadata ptr %arrayidx, metadata !DIExpression()), !dbg !2350 %sub3 = fsub float %call1, %k2, !dbg !4851 %sub4 = fsub float %sub3, %k4, !dbg !4952 %arrayidx5 = getelementptr inbounds [4 x float], ptr %quad, i64 0, i64 1, !dbg !5053 store float %sub4, ptr %arrayidx5, align 4, !dbg !51, !DIAssignID !5254 call void @llvm.dbg.assign(metadata float %sub4, metadata !16, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32), metadata !52, metadata ptr %arrayidx5, metadata !DIExpression()), !dbg !2355 %add = fadd float %sub, %k3, !dbg !5356 %arrayidx7 = getelementptr inbounds [4 x float], ptr %quad, i64 0, i64 2, !dbg !5457 store float %add, ptr %arrayidx7, align 8, !dbg !55, !DIAssignID !5658 call void @llvm.dbg.assign(metadata float %add, metadata !16, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32), metadata !56, metadata ptr %arrayidx7, metadata !DIExpression()), !dbg !2359 %add9 = fadd float %sub3, %k4, !dbg !5760 %arrayidx10 = getelementptr inbounds [4 x float], ptr %quad, i64 0, i64 3, !dbg !5861 store float %add9, ptr %arrayidx10, align 4, !dbg !59, !DIAssignID !6062 call void @llvm.dbg.assign(metadata float %add9, metadata !16, metadata !DIExpression(DW_OP_LLVM_fragment, 96, 32), metadata !60, metadata ptr %arrayidx10, metadata !DIExpression()), !dbg !2363 %call11 = call float @_Z3extPf(ptr nonnull %arrayidx), !dbg !6164 ret void, !dbg !6265}66 67declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #168declare !dbg !63 dso_local float @_Z3getv() local_unnamed_addr #269declare !dbg !66 dso_local float @_Z3extPf(ptr) local_unnamed_addr #270declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #171declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #372 73!llvm.dbg.cu = !{!0}74!llvm.module.flags = !{!3, !4, !5, !1000}75!llvm.ident = !{!6}76 77!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)78!1 = !DIFile(filename: "test.cpp", directory: "/")79!2 = !{}80!3 = !{i32 7, !"Dwarf Version", i32 4}81!4 = !{i32 2, !"Debug Info Version", i32 3}82!5 = !{i32 1, !"wchar_size", i32 4}83!6 = !{!"clang version 12.0.0"}84!7 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funffff", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)85!8 = !DISubroutineType(types: !9)86!9 = !{null, !10, !10, !10, !10}87!10 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)88!11 = !{!12, !13, !14, !15, !16, !20, !21}89!12 = !DILocalVariable(name: "k1", arg: 1, scope: !7, file: !1, line: 3, type: !10)90!13 = !DILocalVariable(name: "k2", arg: 2, scope: !7, file: !1, line: 3, type: !10)91!14 = !DILocalVariable(name: "k3", arg: 3, scope: !7, file: !1, line: 3, type: !10)92!15 = !DILocalVariable(name: "k4", arg: 4, scope: !7, file: !1, line: 3, type: !10)93!16 = !DILocalVariable(name: "quad", scope: !7, file: !1, line: 4, type: !17)94!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 128, elements: !18)95!18 = !{!19}96!19 = !DISubrange(count: 4)97!20 = !DILocalVariable(name: "c1", scope: !7, file: !1, line: 5, type: !10)98!21 = !DILocalVariable(name: "c2", scope: !7, file: !1, line: 6, type: !10)99!22 = distinct !DIAssignID()100!23 = !DILocation(line: 0, scope: !7)101!24 = distinct !DIAssignID()102!25 = distinct !DIAssignID()103!26 = distinct !DIAssignID()104!27 = distinct !DIAssignID()105!28 = distinct !DIAssignID()106!29 = distinct !DIAssignID()107!30 = distinct !DIAssignID()108!31 = distinct !DIAssignID()109!32 = distinct !DIAssignID()110!33 = distinct !DIAssignID()111!34 = !DILocation(line: 4, column: 3, scope: !7)112!35 = !DILocation(line: 5, column: 14, scope: !7)113!36 = distinct !DIAssignID()114!37 = !DILocation(line: 6, column: 14, scope: !7)115!38 = distinct !DIAssignID()116!39 = !DILocation(line: 7, column: 16, scope: !7)117!40 = !DILocation(line: 7, column: 21, scope: !7)118!41 = !DILocation(line: 7, column: 3, scope: !7)119!42 = !DILocation(line: 7, column: 11, scope: !7)120!47 = distinct !DIAssignID()121!48 = !DILocation(line: 8, column: 16, scope: !7)122!49 = !DILocation(line: 8, column: 21, scope: !7)123!50 = !DILocation(line: 8, column: 3, scope: !7)124!51 = !DILocation(line: 8, column: 11, scope: !7)125!52 = distinct !DIAssignID()126!53 = !DILocation(line: 9, column: 21, scope: !7)127!54 = !DILocation(line: 9, column: 3, scope: !7)128!55 = !DILocation(line: 9, column: 11, scope: !7)129!56 = distinct !DIAssignID()130!57 = !DILocation(line: 10, column: 21, scope: !7)131!58 = !DILocation(line: 10, column: 3, scope: !7)132!59 = !DILocation(line: 10, column: 11, scope: !7)133!60 = distinct !DIAssignID()134!61 = !DILocation(line: 11, column: 3, scope: !7)135!62 = !DILocation(line: 12, column: 1, scope: !7)136!63 = !DISubprogram(name: "get", linkageName: "_Z3getv", scope: !1, file: !1, line: 1, type: !64, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)137!64 = !DISubroutineType(types: !65)138!65 = !{!10}139!66 = !DISubprogram(name: "ext", linkageName: "_Z3extPf", scope: !1, file: !1, line: 2, type: !67, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)140!67 = !DISubroutineType(types: !68)141!68 = !{!10, !69}142!69 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)143!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}144