brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · 4ea1493 Raw
72 lines · plain
1; RUN: opt -passes=declare-to-assign -S %s -o - | FileCheck %s2 3;; The variable doesn't fill the whole alloca which has a range of different4;; sized stores to it, overlapping (or not) the variable in various ways. Check5;; the fragment is truncated to represent the intersect between the store and6;; the variable. If that intersect has exactly the same offset and size as the7;; variable then a fragment should not be produced (the whole variable is8;; covered by the store).9;;10;; Check directives written inline.11 12%struct.two = type { i32, i32 }13 14define dso_local noundef i32 @_Z3funv() #0 !dbg !10 {15entry:16  %0 = alloca [4 x i16], align 417  call void @llvm.dbg.declare(metadata ptr %0, metadata !15, metadata !DIExpression()), !dbg !1618; CHECK: %0 = alloca [4 x i16], align 4, !DIAssignID ![[ID1:[0-9]+]]19; CHECK-NEXT: #dbg_assign(i1 poison, ![[#]], !DIExpression(), ![[ID1]], ptr %0, !DIExpression(),20  %a = getelementptr inbounds [4 x i16], ptr %0, i32 0, i32 021  %a.5 = getelementptr inbounds [4 x i16], ptr %0, i32 0, i32 122  %b = getelementptr inbounds [4 x i16], ptr %0, i32 0, i32 223  store i64 1, ptr %a, align 424; CHECK: store i64 1, ptr %a, align 4, !DIAssignID ![[ID2:[0-9]+]]25; CHECK-NEXT: #dbg_assign(i64 1, ![[#]], !DIExpression(), ![[ID2]], ptr %a, !DIExpression(),26  store i64 2, ptr %b, align 427;; %b is outside the variable bounds, no debug intrinsic needed.28  store i16 3, ptr %a.5, align 429; CHECK: store i16 3, ptr %a.5, align 4, !DIAssignID ![[ID3:[0-9]+]]30; CHECK-NEXT: #dbg_assign(i16 3, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 16, 16), ![[ID3]], ptr %a.5, !DIExpression(),31  store i32 4, ptr %a.5, align 432; CHECK: store i32 4, ptr %a.5, align 4, !DIAssignID ![[ID4:[0-9]+]]33; CHECK-NEXT: #dbg_assign(i32 4, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 16, 16), ![[ID4]], ptr %a.5, !DIExpression(),34  store i32 5, ptr %a, align 435; CHECK: store i32 5, ptr %a, align 4, !DIAssignID ![[ID5:[0-9]+]]36; CHECK-NEXT: #dbg_assign(i32 5, ![[#]], !DIExpression(), ![[ID5]], ptr %a, !DIExpression(),37  ret i32 038}39 40declare void @llvm.dbg.declare(metadata, metadata, metadata)41declare i64 @_Z3getv()42 43!llvm.dbg.cu = !{!0}44!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}45!llvm.ident = !{!9}46 47!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 17.0.0)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)48!1 = !DIFile(filename: "test.cpp", directory: "/")49!2 = !{i32 7, !"Dwarf Version", i32 5}50!3 = !{i32 2, !"Debug Info Version", i32 3}51!4 = !{i32 1, !"wchar_size", i32 4}52!5 = !{i32 8, !"PIC Level", i32 2}53!6 = !{i32 7, !"PIE Level", i32 2}54!7 = !{i32 7, !"uwtable", i32 2}55!8 = !{i32 7, !"frame-pointer", i32 2}56!9 = !{!"clang version 17.0.0)"}57!10 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !1, file: !1, line: 3, type: !11, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !14)58!11 = !DISubroutineType(types: !12)59!12 = !{!13}60!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)61!14 = !{}62!15 = !DILocalVariable(name: "a", scope: !10, file: !1, line: 4, type: !13)63!16 = !DILocation(line: 4, column: 9, scope: !10)64!17 = !DILocalVariable(name: "b", scope: !10, file: !1, line: 4, type: !13)65!18 = !DILocation(line: 4, column: 11, scope: !10)66!19 = !DILocalVariable(scope: !10, file: !1, line: 4, type: !20)67!20 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "two", file: !1, line: 1, size: 64, flags: DIFlagTypePassByValue, elements: !21, identifier: "_ZTS3two")68!21 = !{!22, !23}69!22 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !20, file: !1, line: 1, baseType: !13, size: 32)70!23 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !20, file: !1, line: 1, baseType: !13, size: 32, offset: 32)71!25 = !DILocation(line: 4, column: 16, scope: !10)72