brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · fc4c10a Raw
60 lines · plain
1; RUN: opt < %s -passes=add-discriminators -S | FileCheck %s2 3; Basic DWARF discriminator test. All the instructions in block4; 'if.then' should have a different discriminator value than5; the conditional branch at the end of block 'entry'.6;7; Original code:8;9;       void foo(int i) {10;         int x;11;         if (i < 10) x = i;12;       }13 14define void @foo(i32 %i) !dbg !4 {15entry:16  %i.addr = alloca i32, align 417  %x = alloca i32, align 418  store i32 %i, ptr %i.addr, align 419  %0 = load i32, ptr %i.addr, align 4, !dbg !1020  %cmp = icmp slt i32 %0, 10, !dbg !1021  br i1 %cmp, label %if.then, label %if.end, !dbg !1022 23if.then:                                          ; preds = %entry24  %1 = load i32, ptr %i.addr, align 4, !dbg !1025; CHECK:  %1 = load i32, ptr %i.addr, align 4, !dbg ![[THEN:[0-9]+]]26 27  store i32 %1, ptr %x, align 4, !dbg !1028; CHECK:  store i32 %1, ptr %x, align 4, !dbg ![[THEN]]29 30  br label %if.end, !dbg !1031; CHECK:   br label %if.end, !dbg ![[THEN]]32 33if.end:                                           ; preds = %if.then, %entry34  ret void, !dbg !1235; CHECK:   ret void, !dbg ![[END:[0-9]+]]36}37 38!llvm.dbg.cu = !{!0}39!llvm.module.flags = !{!7, !8}40!llvm.ident = !{!9}41 42!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 ", isOptimized: false, emissionKind: NoDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)43!1 = !DIFile(filename: "basic.c", directory: ".")44!2 = !{}45!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)46!5 = !DIFile(filename: "basic.c", directory: ".")47!6 = !DISubroutineType(types: !2)48!7 = !{i32 2, !"Dwarf Version", i32 4}49!8 = !{i32 1, !"Debug Info Version", i32 3}50!9 = !{!"clang version 3.5 "}51!10 = !DILocation(line: 3, scope: !11)52!11 = distinct !DILexicalBlock(line: 3, column: 0, file: !1, scope: !4)53!12 = !DILocation(line: 4, scope: !4)54 55; CHECK: ![[FOO:[0-9]+]] = distinct !DISubprogram(name: "foo"56; CHECK: ![[BLOCK:[0-9]+]] = distinct !DILexicalBlock(scope: ![[FOO]],{{.*}} line: 3)57; CHECK: ![[THEN]] = !DILocation(line: 3, scope: ![[BLOCKFILE:[0-9]+]])58; CHECK: ![[BLOCKFILE]] = !DILexicalBlockFile(scope: ![[BLOCK]],{{.*}} discriminator: 2)59; CHECK: ![[END]] = !DILocation(line: 4, scope: ![[FOO]])60