brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.7 KiB · be0fa78 Raw
115 lines · plain
1; RUN: opt %s -S -passes=sroa -o - | FileCheck %s2 3;; $ cat test.cpp4;; class c {5;;   float b[4];6;; };7;; c fn1();8;; void d() {9;;   c a[3];10;;   a[2] = fn1();11;; }12;;13;; Generated by grabbing IR before sroa in:14;; $ clang++ -O2 -g -c test.cpp -Xclang -fexperimental-assignment-tracking15;;16;; Check that when the memcpy to fragment(256, 128) is split into two 2xfloat17;; stores, the dbg.assign is split into two with fragment(256, 64) &18;; fragment(320, 64). Ensure that only the value-expression gets fragment info;19;; that the address-expression remains untouched.20 21; CHECK: %call = call22; CHECK-NEXT: %0 = extractvalue { <2 x float>, <2 x float> } %call, 023; CHECK-NEXT: %1 = extractvalue { <2 x float>, <2 x float> } %call, 124; CHECK-NEXT: #dbg_value(<2 x float> %0, ![[var:[0-9]+]], !DIExpression(DW_OP_LLVM_fragment, 256, 64),25; CHECK-NEXT: #dbg_value(<2 x float> %1, ![[var]], !DIExpression(DW_OP_LLVM_fragment, 320, 64),26 27%class.c = type { [4 x float] }28 29; Function Attrs: uwtable30define dso_local void @_Z1dv() #0 !dbg !7 {31entry:32  %a = alloca [3 x %class.c], align 16, !DIAssignID !2233  call void @llvm.dbg.assign(metadata i1 undef, metadata !11, metadata !DIExpression(), metadata !22, metadata ptr %a, metadata !DIExpression()), !dbg !2334  %ref.tmp = alloca %class.c, align 435  %0 = bitcast ptr %a to ptr, !dbg !2436  call void @llvm.lifetime.start.p0(i64 48, ptr %0) #4, !dbg !2437  %1 = bitcast ptr %ref.tmp to ptr, !dbg !2538  call void @llvm.lifetime.start.p0(i64 16, ptr %1) #4, !dbg !2539  %call = call { <2 x float>, <2 x float> } @_Z3fn1v(), !dbg !2540  %coerce.dive = getelementptr inbounds %class.c, ptr %ref.tmp, i32 0, i32 0, !dbg !2541  %2 = bitcast ptr %coerce.dive to ptr, !dbg !2542  %3 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %2, i32 0, i32 0, !dbg !2543  %4 = extractvalue { <2 x float>, <2 x float> } %call, 0, !dbg !2544  store <2 x float> %4, ptr %3, align 4, !dbg !2545  %5 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %2, i32 0, i32 1, !dbg !2546  %6 = extractvalue { <2 x float>, <2 x float> } %call, 1, !dbg !2547  store <2 x float> %6, ptr %5, align 4, !dbg !2548  %arrayidx = getelementptr inbounds [3 x %class.c], ptr %a, i64 0, i64 2, !dbg !2649  %7 = bitcast ptr %arrayidx to ptr, !dbg !2750  %8 = bitcast ptr %ref.tmp to ptr, !dbg !2751  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 4 %8, i64 16, i1 false), !dbg !27, !DIAssignID !3252  call void @llvm.dbg.assign(metadata i1 undef, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 256, 128), metadata !32, metadata ptr %7, metadata !DIExpression()), !dbg !2353  %9 = bitcast ptr %ref.tmp to ptr, !dbg !2654  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4, !dbg !2655  %10 = bitcast ptr %a to ptr, !dbg !3356  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #4, !dbg !3357  ret void, !dbg !3358}59 60; Function Attrs: argmemonly nofree nosync nounwind willreturn61declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #162 63; Function Attrs: nofree nosync nounwind readnone speculatable willreturn64declare void @llvm.dbg.declare(metadata, metadata, metadata) #265 66declare !dbg !34 dso_local { <2 x float>, <2 x float> } @_Z3fn1v() #367 68; Function Attrs: argmemonly nofree nosync nounwind willreturn69declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #170 71; Function Attrs: argmemonly nofree nosync nounwind willreturn72declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #173 74; Function Attrs: nofree nosync nounwind readnone speculatable willreturn75declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #276 77!llvm.dbg.cu = !{!0}78!llvm.module.flags = !{!3, !4, !5, !1000}79!llvm.ident = !{!6}80 81!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)82!1 = !DIFile(filename: "reduce.cpp", directory: "/")83!2 = !{}84!3 = !{i32 7, !"Dwarf Version", i32 4}85!4 = !{i32 2, !"Debug Info Version", i32 3}86!5 = !{i32 1, !"wchar_size", i32 4}87!6 = !{!"clang version 12.0.0"}88!7 = distinct !DISubprogram(name: "d", linkageName: "_Z1dv", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)89!8 = !DISubroutineType(types: !9)90!9 = !{null}91!10 = !{!11}92!11 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 6, type: !12)93!12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 384, elements: !20)94!13 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "c", file: !1, line: 1, size: 128, flags: DIFlagTypePassByValue, elements: !14, identifier: "_ZTS1c")95!14 = !{!15}96!15 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !13, file: !1, line: 2, baseType: !16, size: 128)97!16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !17, size: 128, elements: !18)98!17 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)99!18 = !{!19}100!19 = !DISubrange(count: 4)101!20 = !{!21}102!21 = !DISubrange(count: 3)103!22 = distinct !DIAssignID()104!23 = !DILocation(line: 0, scope: !7)105!24 = !DILocation(line: 6, column: 3, scope: !7)106!25 = !DILocation(line: 7, column: 10, scope: !7)107!26 = !DILocation(line: 7, column: 3, scope: !7)108!27 = !DILocation(line: 7, column: 8, scope: !7)109!32 = distinct !DIAssignID()110!33 = !DILocation(line: 8, column: 1, scope: !7)111!34 = !DISubprogram(name: "fn1", linkageName: "_Z3fn1v", scope: !1, file: !1, line: 4, type: !35, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)112!35 = !DISubroutineType(types: !36)113!36 = !{!13}114!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}115