74 lines · plain
1; RUN: opt < %s -S -passes=inline | FileCheck %s2; RUN: opt < %s -S -strip-debug -passes=inline | FileCheck %s3;4 5; https://bugs.llvm.org/show_bug.cgi?id=432916; The purpose of this test is to check if there is use_empty in the inner loop when scanning7; blocks of allocas, if the alloca is use_empty, skip it when allocas inlining.8 9declare void @use(ptr )10 11define void @foo(i16 %k) !dbg !6 {12 call void @llvm.dbg.value(metadata i16 %k, metadata !14, metadata !DIExpression()), !dbg !1513 %alloca_a = alloca i3214 call void @llvm.dbg.value(metadata i16 %k, metadata !14, metadata !DIExpression()), !dbg !1515 %alloca_b = alloca [3 x i32]16 call void @llvm.dbg.value(metadata i16 %k, metadata !14, metadata !DIExpression()), !dbg !1517 %alloca_c = alloca i3218 call void @llvm.dbg.value(metadata i16 %k, metadata !14, metadata !DIExpression()), !dbg !1519 call void @use(ptr %alloca_a), !dbg !1620 call void @use(ptr %alloca_c), !dbg !1621 %_tmp23 = icmp ne i16 %k, 022 br i1 %_tmp23, label %bb1, label %bb223 24bb1: ; preds = %025 store i32 0, ptr %alloca_b26 br label %bb227 28bb2: ; preds = %bb1, %029 ret void30}31 32define i16 @bar() !dbg !17 {33 ; CHECK-LABEL: bar34 ; CHECK: %alloca_a.i = alloca i3235 ; CHECK-NOT: %alloca_b.i = alloca [3 x i32]36 ; CHECK: %alloca_c.i = alloca i3237 call void @foo(i16 0), !dbg !2038 br label %bb139 40bb1: ; preds = %041 ret i16 042}43 44; Function Attrs: nounwind readnone speculatable willreturn45declare void @llvm.dbg.value(metadata, metadata, metadata) #046 47attributes #0 = { nounwind readnone speculatable willreturn }48 49!llvm.dbg.cu = !{!0}50!llvm.module.flags = !{!3, !4}51!llvm.ident = !{!5}52 53!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "Foo", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2)54!1 = !DIFile(filename: "foo2.c", directory: "/tmp")55!2 = !{}56!3 = !{i32 2, !"Dwarf Version", i32 4}57!4 = !{i32 2, !"Debug Info Version", i32 3}58!5 = !{!"Foo"}59!6 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 17, type: !7, scopeLine: 17, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)60!7 = !DISubroutineType(types: !8)61!8 = !{!9, !13}62!9 = !DIDerivedType(tag: DW_TAG_typedef, name: "int64_t", file: !10, line: 76, baseType: !11)63!10 = !DIFile(filename: "stdint.h", directory: "/tmp")64!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "__i64_t", file: !1, baseType: !12)65!12 = !DIBasicType(name: "signed long long", size: 64, encoding: DW_ATE_signed)66!13 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)67!14 = !DILocalVariable(name: "k", arg: 1, scope: !6, file: !1, line: 17, type: !13)68!15 = !DILocation(line: 0, scope: !6)69!16 = !DILocation(line: 19, column: 3, scope: !6)70!17 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 8, type: !18, scopeLine: 8, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)71!18 = !DISubroutineType(types: !19)72!19 = !{!13}73!20 = !DILocation(line: 8, column: 7, scope: !17)74