73 lines · plain
1; RUN: opt -S %s -passes=inline -o - \2; RUN: | FileCheck %s --implicit-check-not="#dbg_"3 4;; The dbg.assign linked to the large alloca describes a variable sitting at5;; offset 0, size 64. Check:6;; A) an inlined store to the alloca outside of the bits 0-64 is not attributed7;; to the variable.8;; B) a fragment expression is not created if the inlined store is the size of9;; the variable.10;; C) a fragment expression is created if the inlined store is not the size of11;; the variable.12 13;; Test A:14; CHECK: %0 = alloca %"struct.llvm::detail::DenseMapPair", i32 0, align 8, !DIAssignID ![[ID1:[0-9]+]]15; CHECK: #dbg_assign(i1 undef, ![[#]], !DIExpression(), ![[ID1]], ptr %0, !DIExpression(),16 17;; Test B:18;; CHECK: store i64 1, ptr %0, align 4, !DIAssignID ![[ID2:[0-9]+]]19;; CHECK: #dbg_assign(i64 1, ![[#]], !DIExpression(), ![[ID2]], ptr %0, !DIExpression(),20 21;; Test C:22;; CHECK: store i32 2, ptr %0, align 4, !DIAssignID ![[ID3:[0-9]+]]23;; CHECK: #dbg_assign(i32 2, ![[#]], !DIExpression(DW_OP_LLVM_fragment, 0, 32), ![[ID3]], ptr %0, !DIExpression(),24 25%"struct.llvm::detail::DenseMapPair" = type { %"struct.std::pair" }26%"struct.std::pair" = type { ptr, %"class.llvm::SmallVector" }27%"class.llvm::SmallVector" = type { %"class.llvm::SmallVectorImpl", %"struct.llvm::SmallVectorStorage" }28%"class.llvm::SmallVectorImpl" = type { %"class.llvm::SmallVectorTemplateBase" }29%"class.llvm::SmallVectorTemplateBase" = type { %"class.llvm::SmallVectorTemplateCommon" }30%"class.llvm::SmallVectorTemplateCommon" = type { %"class.llvm::SmallVectorBase" }31%"class.llvm::SmallVectorBase" = type { ptr, i64, i64 }32%"struct.llvm::SmallVectorStorage" = type { [40 x i8] }33 34define void @_Z6verifyv() {35entry:36 %0 = alloca %"struct.llvm::detail::DenseMapPair", i32 0, align 8, !DIAssignID !537 call void @llvm.dbg.assign(metadata i1 undef, metadata !6, metadata !DIExpression(), metadata !5, metadata ptr %0, metadata !DIExpression()), !dbg !1438 call void @_ZN4llvm6detail12DenseMapPairIP4SCEVNS_11SmallVectorI6FoldIDLj40EEEEC2ERKS7_(ptr %0)39 ret void40}41 42define linkonce_odr void @_ZN4llvm6detail12DenseMapPairIP4SCEVNS_11SmallVectorI6FoldIDLj40EEEEC2ERKS7_(ptr %this) {43entry:44 %second.i = getelementptr %"struct.std::pair", ptr %this, i64 0, i32 145 store i32 0, ptr %second.i, align 446 %test = getelementptr %"struct.std::pair", ptr %this, i64 0, i32 047 store i64 1, ptr %test48 store i32 2, ptr %test49 ret void50}51 52declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)53 54!llvm.dbg.cu = !{!0}55!llvm.module.flags = !{!3, !4}56 57!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 17.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2, splitDebugInlining: false, nameTableKind: None)58!1 = !DIFile(filename: "reduce.cpp", directory: "")59!2 = !{}60!3 = !{i32 2, !"Debug Info Version", i32 3}61!4 = !{i32 7, !"debug-info-assignment-tracking", i1 true}62!5 = distinct !DIAssignID()63!6 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 10, type: !12)64!7 = distinct !DILexicalBlock(scope: !8, file: !1, line: 10, column: 3)65!8 = distinct !DILexicalBlock(scope: !9, file: !1, line: 10, column: 3)66!9 = distinct !DISubprogram(name: "verify", linkageName: "_Z6verifyv", scope: !1, file: !1, line: 9, type: !10, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)67!10 = !DISubroutineType(types: !11)68!11 = !{null}69!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64)70!13 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "SCEV", file: !1, line: 3, flags: DIFlagFwdDecl | DIFlagNonTrivial, identifier: "_ZTS4SCEV")71!14 = !DILocation(line: 0, scope: !7)72 73