1; RUN: llc < %s -mtriple i386-unknown-unknown -O1 -stop-before=finalize-isel | FileCheck %s 2 3; Test case is designed to show the differences related to how implicit values 4; are handled by SelectionDAGBuilder::EmitFuncArgumentDbgValue. 5; 6; One purpose is to validate a bugfix in DIExpression::isImplicit() related 7; to DIExpressions containing both DW_OP_stack_value and DW_OP_LLVM_fragment. 8; 9; IR generated by: 10; 11; // clang -S -target i386-- -Wall -g -O1 -mllvm -stop-before=finalize-isel 12; 13; typedef struct { 14; int x; 15; int *y; 16; } bar; 17; 18; bar* func1(bar *p1, long p2, bar p3) 19; { 20; bar *foo1 = p1+18; 21; p3.y = &((p1+18)->x); 22; return p1; 23; } 24 25 26target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128" 27target triple = "i386-unknown-unknown" 28 29%struct.bar = type { i32, ptr } 30 31; Function Attrs: norecurse nounwind readnone 32define dso_local ptr @func1(ptr readnone returned %0, i32 %1, i32 %2, ptr nocapture readnone %3) local_unnamed_addr #0 !dbg !8 { 33; CHECK-DAG: DBG_VALUE %fixed-stack.1, 0, {{.*}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32), 34; CHECK-DAG: DBG_VALUE %fixed-stack.0, 0, {{.*}}, !DIExpression(DW_OP_LLVM_fragment, 32, 32), 35; CHECK-DAG: DBG_VALUE %fixed-stack.3, 0, {{.*}}, !DIExpression(), 36; CHECK-DAG: DBG_VALUE %fixed-stack.2, 0, {{.*}}, !DIExpression(), 37; CHECK-DAG: DBG_VALUE %fixed-stack.3, 0, {{.*}}, !DIExpression(DW_OP_plus_uconst, 144, DW_OP_stack_value), 38; CHECK-DAG: DBG_VALUE %fixed-stack.3, 0, {{.*}}, !DIExpression(DW_OP_plus_uconst, 144, DW_OP_stack_value, DW_OP_LLVM_fragment, 32, 32), 39 40 call void @llvm.dbg.value(metadata i32 %2, metadata !24, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !26 41 call void @llvm.dbg.value(metadata ptr %3, metadata !24, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !26 42 call void @llvm.dbg.value(metadata ptr %0, metadata !22, metadata !DIExpression()), !dbg !26 43 call void @llvm.dbg.value(metadata i32 %1, metadata !23, metadata !DIExpression()), !dbg !26 44 call void @llvm.dbg.value(metadata ptr %0, metadata !25, metadata !DIExpression(DW_OP_plus_uconst, 144, DW_OP_stack_value)), !dbg !26 45 call void @llvm.dbg.value(metadata ptr %0, metadata !24, metadata !DIExpression(DW_OP_plus_uconst, 144, DW_OP_stack_value, DW_OP_LLVM_fragment, 32, 32)), !dbg !26 46 ret ptr %0, !dbg !27 47} 48 49; Function Attrs: nounwind readnone speculatable willreturn 50declare void @llvm.dbg.value(metadata, metadata, metadata) #1 51 52attributes #0 = { norecurse nounwind readnone } 53attributes #1 = { nounwind readnone speculatable willreturn } 54 55!llvm.dbg.cu = !{!0} 56!llvm.module.flags = !{!3, !4, !5, !6} 57!llvm.ident = !{!7} 58 59!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (trunk 375507)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) 60!1 = !DIFile(filename: "example.c", directory: "/home/ubuntu") 61!2 = !{} 62!3 = !{i32 1, !"NumRegisterParameters", i32 0} 63!4 = !{i32 2, !"Dwarf Version", i32 4} 64!5 = !{i32 2, !"Debug Info Version", i32 3} 65!6 = !{i32 1, !"wchar_size", i32 4} 66!7 = !{!"clang version 10.0.0 (trunk 375507)"} 67!8 = distinct !DISubprogram(name: "func1", scope: !9, file: !9, line: 6, type: !10, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !21) 68!9 = !DIFile(filename: "./example.c", directory: "/home/ubuntu") 69!10 = !DISubroutineType(types: !11) 70!11 = !{!12, !12, !20, !13} 71!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 32) 72!13 = !DIDerivedType(tag: DW_TAG_typedef, name: "bar", file: !9, line: 4, baseType: !14) 73!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !9, line: 1, size: 64, elements: !15) 74!15 = !{!16, !18} 75!16 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !14, file: !9, line: 2, baseType: !17, size: 32) 76!17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 77!18 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !14, file: !9, line: 3, baseType: !19, size: 32, offset: 32) 78!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !17, size: 32) 79!20 = !DIBasicType(name: "long int", size: 32, encoding: DW_ATE_signed) 80!21 = !{!22, !23, !24, !25} 81!22 = !DILocalVariable(name: "p1", arg: 1, scope: !8, file: !9, line: 6, type: !12) 82!23 = !DILocalVariable(name: "p2", arg: 2, scope: !8, file: !9, line: 6, type: !20) 83!24 = !DILocalVariable(name: "p3", arg: 3, scope: !8, file: !9, line: 6, type: !13) 84!25 = !DILocalVariable(name: "foo1", scope: !8, file: !9, line: 8, type: !12) 85!26 = !DILocation(line: 0, scope: !8) 86!27 = !DILocation(line: 10, column: 4, scope: !8) 87