78 lines · plain
1; RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -stop-after=livedebugvalues | FileCheck %s2;3; In the C below, 'baz' is re-assigned with a value that gets salvaged, making4; it's dbg.value base itself on 'bar', but with a complex expression.5; LiveDebugValues should recognize that these are different locations, and not6; propagate a location for 'baz' into the return block.7;8; void escape1(int bees);9; void escape2(int bees);10;11; int foo(int bar) {12; int baz = bar;13; if (baz == 12) {14; escape1(bar);15; } else {16; baz += 1;17; escape2(bar);18; }19;20; return bar;21; }22;23; We should get a plain DBG_VALUE in the entry block, a plain one then complex24; one in the block two, and none in block three.25; CHECK: ![[BAZVAR:[0-9]+]] = !DILocalVariable(name: "baz",26; CHECK-LABEL: bb.0.entry:27; CHECK: DBG_VALUE {{[0-9a-zA-Z$%_]*}}, $noreg, ![[BAZVAR]],28; CHECK-SAME: !DIExpression()29; CHECK-LABEL: bb.1.if.then:30; CHECK-LABEL: bb.2.if.else:31; CHECK: DBG_VALUE {{[0-9a-zA-Z$%_]*}}, $noreg, ![[BAZVAR]],32; CHECK-SAME: !DIExpression()33; CHECK: DBG_VALUE_LIST ![[BAZVAR]],34; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_plus_uconst, 1, DW_OP_stack_value)35; CHECK-SAME: {{[0-9a-zA-Z$%_]*}}36; CHECK-LABEL: bb.3.if.end:37; CHECK-NOT: DBG_VALUE38; CHECK-NOT: DBG_VALUE_LIST39 40declare void @escape1(i32)41declare void @escape2(i32)42declare void @llvm.dbg.value(metadata, metadata, metadata)43 44define i32 @foo(i32 returned %bar) !dbg !7 {45entry:46 call void @llvm.dbg.value(metadata i32 %bar, metadata !13, metadata !DIExpression()), !dbg !1447 %cmp = icmp eq i32 %bar, 12, !dbg !1448 br i1 %cmp, label %if.then, label %if.else, !dbg !1449 50if.then:51 tail call void @escape1(i32 12) #3, !dbg !1452 br label %if.end, !dbg !1453 54if.else:55 call void @llvm.dbg.value(metadata i32 %bar, metadata !13, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)), !dbg !1456 tail call void @escape2(i32 %bar) #3, !dbg !1457 br label %if.end58 59if.end:60 ret i32 %bar, !dbg !1461}62 63!llvm.dbg.cu = !{!0}64!llvm.module.flags = !{!3, !4}65 66!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)67!1 = !DIFile(filename: "exprconflict.c", directory: "/home/jmorse")68!2 = !{}69!3 = !{i32 2, !"Dwarf Version", i32 4}70!4 = !{i32 2, !"Debug Info Version", i32 3}71!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)72!8 = !DISubroutineType(types: !9)73!9 = !{!10, !10}74!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)75!11 = !{!13}76!13 = !DILocalVariable(name: "baz", scope: !7, file: !1, line: 6, type: !10)77!14 = !DILocation(line: 1, scope: !7)78