1; REQUIRES: plugins
2; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -silence-passes -disable-namedmd-remove -disable-strip-debuginfo -disable-strip-debug-types > /dev/null
3; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck %s
4;
5; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t-nodebug -bugpoint-crashcalls -silence-passes -disable-namedmd-remove > /dev/null
6; RUN: llvm-dis %t-nodebug-reduced-simplified.bc -o - | FileCheck %s --check-prefix=NODEBUG
7;
8; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t-notype -bugpoint-crashcalls -silence-passes -disable-namedmd-remove -disable-strip-debuginfo > /dev/null
9; RUN: llvm-dis %t-notype-reduced-simplified.bc -o - | FileCheck %s --check-prefix=NOTYPE
10;
11; Bugpoint can drop the metadata on the call, as it does not contrinute to the crash.
12
13; CHECK: call void @foo()
14; NODEBUG: call void @foo()
15; NOTYPE: call void @foo()
16; NODEBUG-NOT: call void @foo()
17; NOTYPE-NOT: !DIBasicType
18; NOTYPE: !DICompileUnit
19; NOTYPE-NOT: !DIBasicType
20
21%rust_task = type {}
22define void @test(i32* %a, i8* %b) !dbg !9 {
23    %s = mul i8 22, 9, !attach !0, !dbg !10
24    store i8 %s, i8* %b, !attach !1, !dbg !11
25    call void @foo(), !attach !2, !dbg !12
26    store i32 7, i32* %a, !attach !3, !dbg !13
27    %t = add i32 0, 5, !attach !4, !dbg !14
28    ret void
29}
30
31declare void @foo()
32
33!llvm.module.flags = !{!17}
34!llvm.dbg.cu = !{!8}
35
36!0 = !{!"boring"}
37!1 = !{!"uninteresting"}
38!2 = !{!"the call to foo"}
39!3 = !{!"noise"}
40!4 = !{!"filler"}
41
42!8 = distinct !DICompileUnit(language: DW_LANG_C99, file: !15)
43!9 = distinct !DISubprogram(name: "test", file: !15, type: !18, unit: !8)
44!10 = !DILocation(line: 100, column: 101, scope: !9)
45!11 = !DILocation(line: 102, column: 103, scope: !9)
46!12 = !DILocation(line: 104, column: 105, scope: !9)
47!13 = !DILocation(line: 106, column: 107, scope: !9)
48!14 = !DILocation(line: 108, column: 109, scope: !9)
49!15 = !DIFile(filename: "source.c", directory: "/dir")
50!16 = !{}
51!17 = !{i32 1, !"Debug Info Version", i32 3}
52!18 = !DISubroutineType(types: !19)
53!19 = !{!20, !20}
54!20 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
55