103 lines · plain
1; RUN: opt -passes=instcombine %s -S | FileCheck %s2;3; Generate me from:4; clang -cc1 -triple thumbv7-apple-ios7.0.0 -S -target-abi apcs-gnu -gdwarf-2 -Os test.c -o test.ll -emit-llvm5; void run(float r)6; {7; int count = r;8; float vla[count];9; vla[0] = r;10; for (int i = 0; i < count; i++)11; vla[i] /= r;12; }13; rdar://problem/1546457114;15; ModuleID = 'test.c'16target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"17target triple = "thumbv7-apple-ios8.0.0"18 19; Function Attrs: nounwind optsize readnone20define void @run(float %r) #0 !dbg !4 {21entry:22 tail call void @llvm.dbg.value(metadata float %r, metadata !11, metadata !DIExpression()), !dbg !2223 %conv = fptosi float %r to i32, !dbg !2324 tail call void @llvm.dbg.value(metadata i32 %conv, metadata !12, metadata !DIExpression()), !dbg !2325 %vla = alloca float, i32 %conv, align 4, !dbg !2426 tail call void @llvm.dbg.declare(metadata ptr %vla, metadata !14, metadata !DIExpression(DW_OP_deref)), !dbg !2427; The VLA alloca should be described by a dbg.declare:28; CHECK: #dbg_declare(ptr %vla, ![[VLA:.*]], {{.*}})29; The VLA alloca and following store into the array should not be lowered to like this:30; CHECK-NOT: #dbg_value(float %r, ![[VLA]])31; the backend interprets this as "vla has the location of %r".32 store float %r, ptr %vla, align 4, !dbg !25, !tbaa !2633 tail call void @llvm.dbg.value(metadata i32 0, metadata !18, metadata !DIExpression()), !dbg !3034 %cmp8 = icmp sgt i32 %conv, 0, !dbg !3035 br i1 %cmp8, label %for.body, label %for.end, !dbg !3036 37for.body: ; preds = %entry, %for.body.for.body_crit_edge38 %0 = phi float [ %.pre, %for.body.for.body_crit_edge ], [ %r, %entry ]39 %i.09 = phi i32 [ %inc, %for.body.for.body_crit_edge ], [ 0, %entry ]40 %arrayidx2 = getelementptr inbounds float, ptr %vla, i32 %i.09, !dbg !3141 %div = fdiv float %0, %r, !dbg !3142 store float %div, ptr %arrayidx2, align 4, !dbg !31, !tbaa !2643 %inc = add nsw i32 %i.09, 1, !dbg !3044 tail call void @llvm.dbg.value(metadata i32 %inc, metadata !18, metadata !DIExpression()), !dbg !3045 %exitcond = icmp eq i32 %inc, %conv, !dbg !3046 br i1 %exitcond, label %for.end, label %for.body.for.body_crit_edge, !dbg !3047 48for.body.for.body_crit_edge: ; preds = %for.body49 %arrayidx2.phi.trans.insert = getelementptr inbounds float, ptr %vla, i32 %inc50 %.pre = load float, ptr %arrayidx2.phi.trans.insert, align 4, !dbg !31, !tbaa !2651 br label %for.body, !dbg !3052 53for.end: ; preds = %for.body, %entry54 ret void, !dbg !3255}56 57; Function Attrs: nounwind readnone58declare void @llvm.dbg.declare(metadata, metadata, metadata) #159 60; Function Attrs: nounwind readnone61declare void @llvm.dbg.value(metadata, metadata, metadata) #162 63attributes #0 = { nounwind optsize readnone "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "use-soft-float"="false" }64attributes #1 = { nounwind readnone }65 66!llvm.dbg.cu = !{!0}67!llvm.module.flags = !{!20, !33}68!llvm.ident = !{!21}69 70!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)71!1 = !DIFile(filename: "<unknown>", directory: "/Volumes/Data/radar/15464571")72!2 = !{}73!4 = distinct !DISubprogram(name: "run", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 2, file: !5, scope: !6, type: !7, retainedNodes: !10)74!5 = !DIFile(filename: "test.c", directory: "/Volumes/Data/radar/15464571")75!6 = !DIFile(filename: "test.c", directory: "/Volumes/Data/radar/15464571")76!7 = !DISubroutineType(types: !8)77!8 = !{null, !9}78!9 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)79!10 = !{!11, !12, !14, !18}80!11 = !DILocalVariable(name: "r", line: 1, arg: 1, scope: !4, file: !6, type: !9)81!12 = !DILocalVariable(name: "count", line: 3, scope: !4, file: !6, type: !13)82!13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)83!14 = !DILocalVariable(name: "vla", line: 4, scope: !4, file: !6, type: !15)84!15 = !DICompositeType(tag: DW_TAG_array_type, align: 32, baseType: !9, elements: !16)85!16 = !{!17}86!17 = !DISubrange(count: -1)87!18 = !DILocalVariable(name: "i", line: 6, scope: !19, file: !6, type: !13)88!19 = distinct !DILexicalBlock(line: 6, column: 0, file: !5, scope: !4)89!20 = !{i32 2, !"Dwarf Version", i32 2}90!21 = !{!"clang version 3.4 "}91!22 = !DILocation(line: 1, scope: !4)92!23 = !DILocation(line: 3, scope: !4)93!24 = !DILocation(line: 4, scope: !4)94!25 = !DILocation(line: 5, scope: !4)95!26 = !{!27, !27, i64 0}96!27 = !{!"float", !28, i64 0}97!28 = !{!"omnipotent char", !29, i64 0}98!29 = !{!"Simple C/C++ TBAA"}99!30 = !DILocation(line: 6, scope: !19)100!31 = !DILocation(line: 7, scope: !19)101!32 = !DILocation(line: 8, scope: !4)102!33 = !{i32 1, !"Debug Info Version", i32 3}103