91 lines · plain
1; RUN: llc -mtriple=mips64-unknown-freebsd -target-abi n64 -relocation-model pic -verify-machineinstrs -o /dev/null %s -O22 3; Test that the presence of debug information does not cause the branch folder4; to rewrite branches to have negative basic block ids, which would cause the5; long branch pass to crash.6 7@c = external global i32, align 48 9define void @e() !dbg !19 {10entry:11 %0 = load i32, ptr @c, align 4, !dbg !28, !tbaa !3112 %tobool8 = icmp eq i32 %0, 0, !dbg !3513 br i1 %tobool8, label %for.end, label %for.body.preheader, !dbg !3514 15for.body.preheader: ; preds = %entry16 br label %for.body, !dbg !3617 18for.body: ; preds = %for.body.preheader19 %1 = load i8, ptr undef, align 1, !dbg !36, !tbaa !3820 %conv = zext i8 %1 to i32, !dbg !3621 %cmp = icmp sgt i32 %0, %conv, !dbg !3922 br i1 %cmp, label %if.end, label %if.then, !dbg !4023 24if.then: ; preds = %for.body25 tail call void @llvm.dbg.value(metadata i32 %conv, metadata !41, metadata !DIExpression()), !dbg !4326 %idxprom5 = zext i8 %1 to i64, !dbg !4427 %call = tail call i32 @g(i32 signext undef) #3, !dbg !4528 br label %if.end, !dbg !4629 30if.end: ; preds = %if.then, %for.body31 unreachable32 33for.end: ; preds = %entry34 ret void35}36 37declare i32 @g(...)38 39declare void @llvm.dbg.value(metadata, metadata, metadata)40 41!llvm.dbg.cu = !{!0}42!llvm.module.flags = !{!17, !18}43 44!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3)45!1 = !DIFile(filename: "/local/scratch/alr48/cheri/llvm/tools/clang/test/CodeGen/<stdin>", directory: "/local/scratch/alr48/cheri/llvm/cmake-build-debug/tools/clang/test/CodeGen")46!2 = !{}47!3 = !{!4, !9, !13, !15}48!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())49!5 = distinct !DIGlobalVariable(name: "a", scope: !0, file: !6, line: 6, type: !7, isLocal: false, isDefinition: true)50!6 = !DIFile(filename: "/crash.c", directory: "/tmp")51!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64)52!8 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char)53!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())54!10 = distinct !DIGlobalVariable(name: "b", scope: !0, file: !6, line: 7, type: !11, isLocal: false, isDefinition: true)55!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)56!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)57!13 = !DIGlobalVariableExpression(var: !14, expr: !DIExpression())58!14 = distinct !DIGlobalVariable(name: "c", scope: !0, file: !6, line: 8, type: !12, isLocal: false, isDefinition: true)59!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())60!16 = distinct !DIGlobalVariable(name: "d", scope: !0, file: !6, line: 8, type: !12, isLocal: false, isDefinition: true)61!17 = !{i32 2, !"Debug Info Version", i32 3}62!18 = !{i32 7, !"PIC Level", i32 2}63!19 = distinct !DISubprogram(name: "e", scope: !6, file: !6, line: 9, type: !20, isLocal: false, isDefinition: true, scopeLine: 9, isOptimized: true, unit: !0, retainedNodes: !22)64!20 = !DISubroutineType(types: !21)65!21 = !{!12}66!22 = !{!23}67!23 = !DILocalVariable(name: "f", scope: !24, file: !6, line: 12, type: !12)68!24 = distinct !DILexicalBlock(scope: !25, file: !6, line: 11, column: 20)69!25 = distinct !DILexicalBlock(scope: !26, file: !6, line: 11, column: 9)70!26 = distinct !DILexicalBlock(scope: !27, file: !6, line: 10, column: 3)71!27 = distinct !DILexicalBlock(scope: !19, file: !6, line: 10, column: 3)72!28 = !DILocation(line: 10, column: 10, scope: !29)73!29 = distinct !DILexicalBlock(scope: !30, file: !6, line: 10, column: 3)74!30 = distinct !DILexicalBlock(scope: !19, file: !6, line: 10, column: 3)75!31 = !{!32, !32, i64 0}76!32 = !{!"int", !33, i64 0}77!33 = !{!"omnipotent char", !34, i64 0}78!34 = !{!"Simple C/C++ TBAA"}79!35 = !DILocation(line: 10, column: 3, scope: !30)80!36 = !DILocation(line: 11, column: 9, scope: !37)81!37 = distinct !DILexicalBlock(scope: !29, file: !6, line: 11, column: 9)82!38 = !{!33, !33, i64 0}83!39 = !DILocation(line: 11, column: 14, scope: !37)84!40 = !DILocation(line: 11, column: 9, scope: !29)85!41 = !DILocalVariable(name: "f", scope: !42, file: !6, line: 12, type: !12)86!42 = distinct !DILexicalBlock(scope: !37, file: !6, line: 11, column: 20)87!43 = !DILocation(line: 12, column: 11, scope: !42)88!44 = !DILocation(line: 13, column: 9, scope: !42)89!45 = !DILocation(line: 13, column: 7, scope: !42)90!46 = !DILocation(line: 14, column: 5, scope: !42)91