1 ; RUN: llc -mtriple mips64-unknown-freebsd12.0 -relocation-model pic -mcpu=mips4 -target-abi n64 -O2 -verify-machineinstrs -o - %s
3 ; Test that the long branch pass does not crash due to the control flow
4 ; optimizer producing malformed basic block operands due to the backend
5 ; failing to handle debug information around branch instructions.
7 define void @f() !dbg !5 {
9 %cmp = icmp eq i32 undef, 0, !dbg !16
10 %conv = zext i1 %cmp to i32, !dbg !16
11 tail call void @llvm.dbg.value(metadata i32 %conv, metadata !11, metadata !DIExpression()), !dbg !17
12 %tobool = icmp eq i32 undef, 0, !dbg !18
13 br i1 %tobool, label %if.end, label %cleanup7.critedge, !dbg !21
15 if.end: ; preds = %entry
16 %call6 = call i32 @j(i32 signext %conv)
18 br label %cleanup7, !dbg !23
20 cleanup7.critedge: ; preds = %entry
21 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull undef) #4, !dbg !24
24 cleanup7: ; preds = %cleanup7.critedge,
28 declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1
32 declare void @llvm.dbg.value(metadata, metadata, metadata) #3
33 attributes #1 = { argmemonly nounwind }
34 attributes #3 = { nounwind readnone speculatable }
35 attributes #4 = { nounwind }
38 !llvm.module.flags = !{!3, !4}
40 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang
41 version 6.0.0", isOptimized: true, runtimeVersion:
42 0, emissionKind: FullDebug, enums: !2)
43 !1 = !DIFile(filename:
44 "/tmp//<stdin>", directory:
47 !3 = !{i32 2, !"Debug Info Version", i32 3}
48 !4 = !{i32 7, !"PIC Level", i32 2}
49 !5 = distinct !DISubprogram(name: "f", scope: !6, file: !6, line: 8, type: !7,
50 isLocal: false, isDefinition: true, scopeLine: 8, isOptimized: true, unit: !0,
52 !6 = !DIFile(filename:
55 !7 = !DISubroutineType(types: !8)
57 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
58 !10 = !{!11, !12, !14}
59 !11 = !DILocalVariable(name: "e", scope: !5, file: !6, line: 9, type: !9)
60 !12 = !DILocalVariable(name: "g", scope: !13, file: !6, line: 11, type: !9)
61 !13 = distinct !DILexicalBlock(scope: !5, file: !6, line: 10, column: 3)
62 !14 = !DILocalVariable(name: "d", scope: !13, file: !6, line: 12, type: !15)
63 !15 = !DIDerivedType(tag: DW_TAG_typedef, name: "a", file: !6, line: 2,
65 !16 = !DILocation(line: 9, column: 15, scope: !5)
66 !17 = !DILocation(line: 9, column: 7, scope: !5)
67 !18 = !DILocation(line: 12, column: 5, scope: !19)
68 !19 = distinct !DILexicalBlock(scope: !20, file: !6, line: 12, column: 5)
69 !20 = distinct !DILexicalBlock(scope: !5, file: !6, line: 10, column: 3)
70 !21 = !DILocation(line: 12, column: 5, scope: !20)
71 !22 = !DILocation(line: 16, column: 3, scope: !5)
72 !23 = !DILocation(line: 17, column: 1, scope: !5)
73 !24 = !DILocation(line: 15, column: 3, scope: !5)