300 lines · plain
1# RUN: llc -run-pass=livedebugvalues -o - %s | FileCheck %s2 3# Test the extension of debug ranges from 3 predecessors.4# Generated from the source file LiveDebugValues-3preds.c:5# #include <stdio.h>6# int add(int x, int y, int z, int a) {7# int i;8# for (i = 0; i < x * y; i++) {9# if (i < x) {10# a = a * x;11# break;12# }13# if (i < y) {14# a = a * y;15# break;16# }17# if (i < z) {18# a = a * z;19# break;20# }21# }22# return a;23# }24# with clang -g -O1 -c -emit-llvm LiveDebugValues-3preds.c -S -o live-debug-values-3preds.ll25# then llc -stop-after stackmap-liveness live-debug-values-3preds.ll -o /dev/null > live-debug-values-3preds.mir26 27# CHECK: ![[X_VAR:[0-9]+]] = !DILocalVariable(name: "x", {{.*}})28# CHECK: ![[Y_VAR:[0-9]+]] = !DILocalVariable(name: "y", {{.*}})29# CHECK: ![[Z_VAR:[0-9]+]] = !DILocalVariable(name: "z", {{.*}})30 31# DBG_VALUE for variables "x", "y" and "z" are extended into %bb.9 from its32# predecessors %bb.0, %bb.2 and %bb.8.33# CHECK: bb.9.for.end:34# CHECK-DAG: DBG_VALUE $edi, $noreg, ![[X_VAR]], !DIExpression()35# CHECK-DAG: DBG_VALUE $esi, $noreg, ![[Y_VAR]], !DIExpression()36# CHECK-DAG: DBG_VALUE $edx, $noreg, ![[Z_VAR]], !DIExpression()37# CHECK: RET38 39--- |40 ; ModuleID = 'live-debug-values-3preds.ll'41 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"42 target triple = "x86_64-unknown-linux-gnu"43 44 ; Function Attrs: norecurse nounwind readnone uwtable45 define i32 @add(i32 %x, i32 %y, i32 %z, i32 %a) #0 !dbg !4 {46 entry:47 tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !9, metadata !17), !dbg !1848 tail call void @llvm.dbg.value(metadata i32 %y, i64 0, metadata !10, metadata !17), !dbg !1949 tail call void @llvm.dbg.value(metadata i32 %z, i64 0, metadata !11, metadata !17), !dbg !2150 tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !12, metadata !17), !dbg !2351 tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !13, metadata !17), !dbg !2552 %mul = mul nsw i32 %y, %x, !dbg !2653 %cmp.24 = icmp sgt i32 %mul, 0, !dbg !3054 br i1 %cmp.24, label %for.body.preheader, label %for.end, !dbg !3155 56 for.body.preheader: ; preds = %entry57 br label %for.body, !dbg !3258 59 for.cond: ; preds = %if.end.660 %cmp = icmp slt i32 %inc, %mul, !dbg !3061 br i1 %cmp, label %for.body, label %for.end, !dbg !3162 63 for.body: ; preds = %for.cond, %for.body.preheader64 %i.025 = phi i32 [ %inc, %for.cond ], [ 0, %for.body.preheader ]65 %0 = icmp sgt i32 %x, 066 br i1 %0, label %if.then, label %if.end, !dbg !3567 68 if.then: ; preds = %for.body69 %mul2 = mul nsw i32 %a, %x, !dbg !3670 tail call void @llvm.dbg.value(metadata i32 %mul2, i64 0, metadata !12, metadata !17), !dbg !2371 br label %for.end, !dbg !3872 73 if.end: ; preds = %for.body74 %1 = icmp sgt i32 %y, 075 br i1 %1, label %if.then.4, label %if.end.6, !dbg !3976 77 if.then.4: ; preds = %if.end78 %mul5 = mul nsw i32 %a, %y, !dbg !4079 tail call void @llvm.dbg.value(metadata i32 %mul5, i64 0, metadata !12, metadata !17), !dbg !2380 br label %for.end, !dbg !4381 82 if.end.6: ; preds = %if.end83 %2 = icmp sgt i32 %z, 084 %inc = add nuw nsw i32 %i.025, 1, !dbg !4485 tail call void @llvm.dbg.value(metadata i32 %inc, i64 0, metadata !13, metadata !17), !dbg !2586 br i1 %2, label %if.then.8, label %for.cond, !dbg !4587 88 if.then.8: ; preds = %if.end.689 %mul9 = mul nsw i32 %a, %z, !dbg !4690 tail call void @llvm.dbg.value(metadata i32 %mul9, i64 0, metadata !12, metadata !17), !dbg !2391 br label %for.end, !dbg !4992 93 for.end: ; preds = %for.cond, %if.then.8, %if.then.4, %if.then, %entry94 %a.addr.0 = phi i32 [ %mul2, %if.then ], [ %mul5, %if.then.4 ], [ %mul9, %if.then.8 ], [ %a, %entry ], [ %a, %for.cond ]95 ret i32 %a.addr.0, !dbg !5096 }97 98 ; Function Attrs: nounwind readnone99 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1100 101 attributes #0 = { norecurse nounwind readnone uwtable }102 attributes #1 = { nounwind readnone }103 104 !llvm.dbg.cu = !{!0}105 !llvm.module.flags = !{!14, !15}106 !llvm.ident = !{!16}107 108 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 253049) ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)109 !1 = !DIFile(filename: "LiveDebugValues-3preds.c", directory: "/home/vt/julia/test/tvvikram")110 !2 = !{}111 !4 = distinct !DISubprogram(name: "add", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !8)112 !5 = !DISubroutineType(types: !6)113 !6 = !{!7, !7, !7, !7, !7}114 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)115 !8 = !{!9, !10, !11, !12, !13}116 !9 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !1, line: 1, type: !7)117 !10 = !DILocalVariable(name: "y", arg: 2, scope: !4, file: !1, line: 1, type: !7)118 !11 = !DILocalVariable(name: "z", arg: 3, scope: !4, file: !1, line: 1, type: !7)119 !12 = !DILocalVariable(name: "a", arg: 4, scope: !4, file: !1, line: 1, type: !7)120 !13 = !DILocalVariable(name: "i", scope: !4, file: !1, line: 2, type: !7)121 !14 = !{i32 2, !"Dwarf Version", i32 4}122 !15 = !{i32 2, !"Debug Info Version", i32 3}123 !16 = !{!"clang version 3.8.0 (trunk 253049) "}124 !17 = !DIExpression()125 !18 = !DILocation(line: 1, column: 13, scope: !4)126 !19 = !DILocation(line: 1, column: 20, scope: !20)127 !20 = !DILexicalBlockFile(scope: !4, file: !1, discriminator: 1)128 !21 = !DILocation(line: 1, column: 27, scope: !22)129 !22 = !DILexicalBlockFile(scope: !4, file: !1, discriminator: 2)130 !23 = !DILocation(line: 1, column: 34, scope: !24)131 !24 = !DILexicalBlockFile(scope: !4, file: !1, discriminator: 3)132 !25 = !DILocation(line: 2, column: 7, scope: !20)133 !26 = !DILocation(line: 3, column: 21, scope: !27)134 !27 = !DILexicalBlockFile(scope: !28, file: !1, discriminator: 1)135 !28 = distinct !DILexicalBlock(scope: !29, file: !1, line: 3, column: 3)136 !29 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3, column: 3)137 !30 = !DILocation(line: 3, column: 17, scope: !27)138 !31 = !DILocation(line: 3, column: 3, scope: !27)139 !32 = !DILocation(line: 4, column: 11, scope: !33)140 !33 = distinct !DILexicalBlock(scope: !34, file: !1, line: 4, column: 9)141 !34 = distinct !DILexicalBlock(scope: !28, file: !1, line: 3, column: 31)142 !35 = !DILocation(line: 4, column: 9, scope: !34)143 !36 = !DILocation(line: 5, column: 13, scope: !37)144 !37 = distinct !DILexicalBlock(scope: !33, file: !1, line: 4, column: 16)145 !38 = !DILocation(line: 6, column: 7, scope: !37)146 !39 = !DILocation(line: 8, column: 9, scope: !34)147 !40 = !DILocation(line: 9, column: 13, scope: !41)148 !41 = distinct !DILexicalBlock(scope: !42, file: !1, line: 8, column: 16)149 !42 = distinct !DILexicalBlock(scope: !34, file: !1, line: 8, column: 9)150 !43 = !DILocation(line: 10, column: 7, scope: !41)151 !44 = !DILocation(line: 3, column: 27, scope: !28)152 !45 = !DILocation(line: 12, column: 9, scope: !34)153 !46 = !DILocation(line: 13, column: 13, scope: !47)154 !47 = distinct !DILexicalBlock(scope: !48, file: !1, line: 12, column: 16)155 !48 = distinct !DILexicalBlock(scope: !34, file: !1, line: 12, column: 9)156 !49 = !DILocation(line: 14, column: 7, scope: !47)157 !50 = !DILocation(line: 17, column: 3, scope: !4)158 159...160---161name: add162alignment: 16163exposesReturnsTwice: false164tracksRegLiveness: true165liveins: 166 - { reg: '$edi' }167 - { reg: '$esi' }168 - { reg: '$edx' }169 - { reg: '$ecx' }170frameInfo: 171 isFrameAddressTaken: false172 isReturnAddressTaken: false173 hasStackMap: false174 hasPatchPoint: false175 stackSize: 0176 offsetAdjustment: 0177 maxAlignment: 0178 adjustsStack: false179 hasCalls: false180 maxCallFrameSize: 0181 hasOpaqueSPAdjustment: false182 hasVAStart: false183 hasMustTailInVarArgFunc: false184body: |185 bb.0.entry:186 successors: %bb.1.for.body.preheader(20), %bb.9.for.end(12)187 liveins: $ecx, $edi, $edx, $esi188 189 DBG_VALUE $edi, _, !9, !17, debug-location !18190 DBG_VALUE $esi, _, !10, !17, debug-location !19191 DBG_VALUE $edx, _, !11, !17, debug-location !21192 DBG_VALUE $ecx, _, !12, !17, debug-location !23193 DBG_VALUE 0, 0, !13, !17, debug-location !25194 $r8d = MOV32rr $esi, debug-location !26195 $r8d = IMUL32rr killed $r8d, $edi, implicit-def dead $eflags, debug-location !26196 TEST32rr $r8d, $r8d, implicit-def $eflags, debug-location !31197 JCC_1 %bb.9.for.end, 14, implicit $eflags198 199 bb.1.for.body.preheader:200 successors: %bb.3.for.body(0)201 liveins: $ecx, $edi, $edx, $esi, $r8d202 203 DBG_VALUE $edi, _, !9, !17, debug-location !18204 DBG_VALUE $esi, _, !10, !17, debug-location !19205 DBG_VALUE $edx, _, !11, !17, debug-location !21206 DBG_VALUE $ecx, _, !12, !17, debug-location !23207 DBG_VALUE 0, 0, !13, !17, debug-location !25208 $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags209 210 bb.3.for.body (align 4):211 successors: %bb.4.if.then(4), %bb.5.if.end(124)212 liveins: $eax, $ecx, $edi, $edx, $esi, $r8d213 214 DBG_VALUE $edi, _, !9, !17, debug-location !18215 DBG_VALUE $esi, _, !10, !17, debug-location !19216 DBG_VALUE $edx, _, !11, !17, debug-location !21217 DBG_VALUE $ecx, _, !12, !17, debug-location !23218 DBG_VALUE 0, 0, !13, !17, debug-location !25219 TEST32rr $edi, $edi, implicit-def $eflags, debug-location !35220 JCC_1 %bb.4.if.then, 15, implicit $eflags221 222 bb.5.if.end:223 successors: %bb.6.if.then.4(4), %bb.7.if.end.6(124)224 liveins: $eax, $ecx, $edi, $edx, $esi, $r8d225 226 DBG_VALUE $edi, _, !9, !17, debug-location !18227 DBG_VALUE $esi, _, !10, !17, debug-location !19228 DBG_VALUE $edx, _, !11, !17, debug-location !21229 DBG_VALUE $ecx, _, !12, !17, debug-location !23230 DBG_VALUE 0, 0, !13, !17, debug-location !25231 TEST32rr $esi, $esi, implicit-def $eflags, debug-location !39232 JCC_1 %bb.6.if.then.4, 15, implicit $eflags233 234 bb.7.if.end.6:235 successors: %bb.8.if.then.8(4), %bb.2.for.cond(124)236 liveins: $eax, $ecx, $edi, $edx, $esi, $r8d237 238 DBG_VALUE $edi, _, !9, !17, debug-location !18239 DBG_VALUE $esi, _, !10, !17, debug-location !19240 DBG_VALUE $edx, _, !11, !17, debug-location !21241 DBG_VALUE $ecx, _, !12, !17, debug-location !23242 DBG_VALUE 0, 0, !13, !17, debug-location !25243 TEST32rr $edx, $edx, implicit-def $eflags, debug-location !45244 JCC_1 %bb.8.if.then.8, 15, implicit $eflags245 246 bb.2.for.cond:247 successors: %bb.3.for.body(124), %bb.9.for.end(4)248 liveins: $eax, $ecx, $edi, $edx, $esi, $r8d249 250 DBG_VALUE $edi, _, !9, !17, debug-location !18251 DBG_VALUE $esi, _, !10, !17, debug-location !19252 DBG_VALUE $edx, _, !11, !17, debug-location !21253 DBG_VALUE $ecx, _, !12, !17, debug-location !23254 DBG_VALUE 0, 0, !13, !17, debug-location !25255 $eax = INC32r killed $eax, implicit-def dead $eflags, debug-location !44256 DBG_VALUE $eax, _, !13, !17, debug-location !25257 CMP32rr $eax, $r8d, implicit-def $eflags, debug-location !31258 JCC_1 %bb.3.for.body, 12, implicit $eflags259 JMP_1 %bb.9.for.end260 261 bb.4.if.then:262 liveins: $ecx, $edi263 264 DBG_VALUE $edi, _, !9, !17, debug-location !18265 DBG_VALUE $ecx, _, !12, !17, debug-location !23266 DBG_VALUE 0, 0, !13, !17, debug-location !25267 $ecx = IMUL32rr killed $ecx, killed $edi, implicit-def dead $eflags, debug-location !36268 DBG_VALUE 0, 0, !13, !17, debug-location !25269 $eax = MOV32rr killed $ecx, debug-location !50270 RET64 $eax, debug-location !50271 272 bb.6.if.then.4:273 liveins: $ecx, $esi274 275 DBG_VALUE $esi, _, !10, !17, debug-location !19276 DBG_VALUE $ecx, _, !12, !17, debug-location !23277 DBG_VALUE 0, 0, !13, !17, debug-location !25278 $ecx = IMUL32rr killed $ecx, killed $esi, implicit-def dead $eflags, debug-location !40279 DBG_VALUE 0, 0, !13, !17, debug-location !25280 $eax = MOV32rr killed $ecx, debug-location !50281 RET64 $eax, debug-location !50282 283 bb.8.if.then.8:284 successors: %bb.9.for.end(0)285 liveins: $ecx, $edx286 287 DBG_VALUE $edx, _, !11, !17, debug-location !21288 DBG_VALUE $ecx, _, !12, !17, debug-location !23289 DBG_VALUE 0, 0, !13, !17, debug-location !25290 $ecx = IMUL32rr killed $ecx, killed $edx, implicit-def dead $eflags, debug-location !46291 292 bb.9.for.end:293 liveins: $ecx294 295 DBG_VALUE 0, 0, !13, !17, debug-location !25296 $eax = MOV32rr killed $ecx, debug-location !50297 RET64 $eax, debug-location !50298 299...300