1; RUN: llc -mtriple mips64-unknown-freebsd12.0 -relocation-model pic -mcpu=mips4 -target-abi n64 -O2 -verify-machineinstrs -o - %s 2 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. 6 7define void @f() !dbg !5 { 8entry: 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 14 15if.end: ; preds = %entry 16 %call6 = call i32 bitcast (i32 (...)* @j to i32 (i32)*)(i32 signext %conv) 17#4, !dbg !22 18 br label %cleanup7, !dbg !23 19 20cleanup7.critedge: ; preds = %entry 21 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull undef) #4, !dbg !24 22 br label %cleanup7 23 24cleanup7: ; preds = %cleanup7.critedge, 25 ret void 26} 27 28declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 29 30declare i32 @j(...) 31 32declare void @llvm.dbg.value(metadata, metadata, metadata) #3 33attributes #1 = { argmemonly nounwind } 34attributes #3 = { nounwind readnone speculatable } 35attributes #4 = { nounwind } 36 37!llvm.dbg.cu = !{!0} 38!llvm.module.flags = !{!3, !4} 39 40!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang 41version 6.0.0", isOptimized: true, runtimeVersion: 420, emissionKind: FullDebug, enums: !2) 43!1 = !DIFile(filename: 44"/tmp//<stdin>", directory: 45"/tmp/") 46!2 = !{} 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, 50isLocal: false, isDefinition: true, scopeLine: 8, isOptimized: true, unit: !0, 51retainedNodes: !10) 52!6 = !DIFile(filename: 53"/tmp/test.c", 54directory: "/tmp") 55!7 = !DISubroutineType(types: !8) 56!8 = !{!9} 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, 64baseType: !9) 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) 74