118 lines · plain
1; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S %s -o - | FileCheck %s2; typedef struct info {3; unsigned long long size;4; } info_t;5; extern unsigned p;6; extern unsigned n;7; void f() {8; unsigned int i;9; if (p) {10; info_t *info = (info_t *)p;11; for (i = 0; i < n; i++)12; use(info[i].size);13; }14; }15source_filename = "debug.i"16target datalayout = "e-m:o-p:32:32-i64:64-a:0:32-n32-S128"17target triple = "thumbv7k-apple-ios10.0.0"18 19%struct.info = type { i64 }20 21@p = external local_unnamed_addr global i32, align 422@n = external local_unnamed_addr global i32, align 423 24; Function Attrs: nounwind ssp uwtable25define void @f() local_unnamed_addr #0 !dbg !16 {26entry:27 %0 = load i32, ptr @p, align 4, !dbg !2528 %tobool = icmp eq i32 %0, 0, !dbg !2529 br i1 %tobool, label %if.end, label %if.then, !dbg !2630 31if.then: ; preds = %entry32 %1 = inttoptr i32 %0 to ptr, !dbg !2733 tail call void @llvm.dbg.value(metadata ptr %1, metadata !22, metadata !DIExpression()), !dbg !2834 ; CHECK: #dbg_value(i32 %0, !22, !DIExpression(),35 tail call void @llvm.dbg.value(metadata i32 0, metadata !20, metadata !DIExpression()), !dbg !2936 %2 = load i32, ptr @n, align 4, !dbg !3037 %cmp5 = icmp eq i32 %2, 0, !dbg !3338 br i1 %cmp5, label %if.end, label %for.body.preheader, !dbg !3439 40for.body.preheader: ; preds = %if.then41 ; CHECK: for.body.preheader:42 ; CHECK: %2 = inttoptr i32 %0 to ptr43 br label %for.body, !dbg !3544 45for.body: ; preds = %for.body.preheader, %for.body46 %lsr.iv = phi ptr [ %1, %for.body.preheader ], [ %scevgep, %for.body ]47 %i.06 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]48 tail call void @llvm.dbg.value(metadata i32 %i.06, metadata !20, metadata !DIExpression()), !dbg !2949 %3 = load i64, ptr %lsr.iv, align 8, !dbg !3550 %call = tail call i32 @use(i64 %3) #3, !dbg !3651 %inc = add nuw i32 %i.06, 1, !dbg !3752 tail call void @llvm.dbg.value(metadata i32 %inc, metadata !20, metadata !DIExpression()), !dbg !2953 %4 = load i32, ptr @n, align 4, !dbg !3054 %scevgep = getelementptr %struct.info, ptr %lsr.iv, i32 1, !dbg !3355 %cmp = icmp ult i32 %inc, %4, !dbg !3356 br i1 %cmp, label %for.body, label %if.end.loopexit, !dbg !34, !llvm.loop !3857 58if.end.loopexit: ; preds = %for.body59 br label %if.end, !dbg !4060 61if.end: ; preds = %if.end.loopexit, %if.then, %entry62 ret void, !dbg !4063}64declare i32 @use(...) local_unnamed_addr #165 66; Function Attrs: nounwind readnone speculatable67declare void @llvm.dbg.value(metadata, metadata, metadata) #268 69attributes #0 = { nounwind ssp uwtable }70attributes #2 = { nounwind readnone speculatable }71attributes #3 = { nobuiltin nounwind }72 73!llvm.dbg.cu = !{!0}74!llvm.module.flags = !{!10, !11, !12, !13, !14}75!llvm.ident = !{!15}76 77!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 (trunk 317231) (llvm/trunk 317262)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3)78!1 = !DIFile(filename: "debug.i", directory: "/Data/radar/35321562")79!2 = !{}80!3 = !{!4}81!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 32)82!5 = !DIDerivedType(tag: DW_TAG_typedef, name: "info_t", file: !1, line: 3, baseType: !6)83!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "info", file: !1, line: 1, size: 64, elements: !7)84!7 = !{!8}85!8 = !DIDerivedType(tag: DW_TAG_member, name: "size", scope: !6, file: !1, line: 2, baseType: !9, size: 64)86!9 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned)87!10 = !{i32 2, !"Dwarf Version", i32 4}88!11 = !{i32 2, !"Debug Info Version", i32 3}89!12 = !{i32 1, !"wchar_size", i32 4}90!13 = !{i32 1, !"min_enum_size", i32 4}91!14 = !{i32 7, !"PIC Level", i32 2}92!15 = !{!"clang version 6.0.0 (trunk 317231) (llvm/trunk 317262)"}93!16 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 6, type: !17, isLocal: false, isDefinition: true, scopeLine: 6, isOptimized: true, unit: !0, retainedNodes: !19)94!17 = !DISubroutineType(types: !18)95!18 = !{null}96!19 = !{!20, !22}97!20 = !DILocalVariable(name: "i", scope: !16, file: !1, line: 7, type: !21)98!21 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)99!22 = !DILocalVariable(name: "info", scope: !23, file: !1, line: 9, type: !4)100!23 = distinct !DILexicalBlock(scope: !24, file: !1, line: 8, column: 10)101!24 = distinct !DILexicalBlock(scope: !16, file: !1, line: 8, column: 7)102!25 = !DILocation(line: 8, column: 7, scope: !24)103!26 = !DILocation(line: 8, column: 7, scope: !16)104!27 = !DILocation(line: 9, column: 20, scope: !23)105!28 = !DILocation(line: 9, column: 13, scope: !23)106!29 = !DILocation(line: 7, column: 16, scope: !16)107!30 = !DILocation(line: 10, column: 21, scope: !31)108!31 = distinct !DILexicalBlock(scope: !32, file: !1, line: 10, column: 5)109!32 = distinct !DILexicalBlock(scope: !23, file: !1, line: 10, column: 5)110!33 = !DILocation(line: 10, column: 19, scope: !31)111!34 = !DILocation(line: 10, column: 5, scope: !32)112!35 = !DILocation(line: 11, column: 19, scope: !31)113!36 = !DILocation(line: 11, column: 7, scope: !31)114!37 = !DILocation(line: 10, column: 25, scope: !31)115!38 = distinct !{!38, !34, !39}116!39 = !DILocation(line: 11, column: 23, scope: !32)117!40 = !DILocation(line: 13, column: 1, scope: !16)118