Skip to content

Commit 9cb2117

Browse files
Merge pull request #7557 from felipepiovezan/felipe/cherry-pick-dbg-value-fix
[cherry-pick] [FastISel][DebugInfo] Handle dbg.value targeting allocas (llvm#67187)
2 parents e8e6ab0 + a82fd5b commit 9cb2117

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

lldb/test/API/lang/swift/variables/consume_operator/TestSwiftConsumeOperator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class TestSwiftConsumeOperatorType(TestBase):
3030

3131
# Skip on aarch64 linux: rdar://91005071
3232
@skipIf(archs=['aarch64'], oslist=['linux'])
33-
@expectedFailureAll(bugnumber='rdar://115518559')
3433
@swiftTest
3534
def test_swift_consume_operator(self):
3635
"""Check that we properly show variables at various points of the CFG while

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,14 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
13271327
<< *DI << "\n");
13281328
return true;
13291329
}
1330+
if (auto SI = FuncInfo.StaticAllocaMap.find(dyn_cast<AllocaInst>(V));
1331+
SI != FuncInfo.StaticAllocaMap.end()) {
1332+
MachineOperand FrameIndexOp = MachineOperand::CreateFI(SI->second);
1333+
bool IsIndirect = false;
1334+
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD.getDL(), II, IsIndirect,
1335+
FrameIndexOp, Var, Expr);
1336+
return true;
1337+
}
13301338
if (Register Reg = lookUpRegForValue(V)) {
13311339
// FIXME: This does not handle register-indirect values at offset 0.
13321340
if (!FuncInfo.MF->useDebugInstrRef()) {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; RUN: llc -fast-isel -fast-isel-abort=1 -mtriple=x86_64-unknown-unknown -stop-after=finalize-isel %s -o - | \
2+
; RUN: FileCheck %s
3+
4+
define void @foo(ptr noalias nocapture %arg) !dbg !38 {
5+
%k.debug = alloca ptr, align 8
6+
store ptr %arg, ptr %k.debug, align 8, !dbg !70
7+
call void @llvm.dbg.value(metadata ptr %k.debug, metadata !55, metadata !DIExpression(DW_OP_deref)), !dbg !70
8+
; CHECK: call void @llvm.dbg.value(metadata ptr %{{.*}}, metadata ![[VAR:.*]], metadata ![[EXPR:.*]])
9+
; CHECK: DBG_VALUE %stack.0{{.*}}, $noreg, ![[VAR]], ![[EXPR]]
10+
ret void, !dbg !70
11+
}
12+
13+
declare void @llvm.dbg.value(metadata, metadata, metadata)
14+
15+
!llvm.module.flags = !{!6, !7, !8, !9}
16+
!llvm.dbg.cu = !{!16}
17+
18+
!6 = !{i32 7, !"Dwarf Version", i32 4}
19+
!7 = !{i32 2, !"Debug Info Version", i32 3}
20+
!8 = !{i32 1, !"wchar_size", i32 4}
21+
!9 = !{i32 8, !"PIC Level", i32 2}
22+
!16 = distinct !DICompileUnit(language: DW_LANG_Swift, file: !17, producer: "blah", isOptimized: false, runtimeVersion: 5, emissionKind: FullDebug, sysroot: "blah", sdk: "blah")
23+
!17 = !DIFile(filename: "blah", directory: "blah")
24+
!38 = distinct !DISubprogram(name: "blah", linkageName: "$blah", scope: !17, file: !17, line: 34, type: !39, scopeLine: 34, spFlags: DISPFlagDefinition, unit: !16, retainedNodes: !43)
25+
!39 = !DISubroutineType(types: !40)
26+
!40 = !{!41, !41}
27+
!41 = !DICompositeType(tag: DW_TAG_structure_type, name: "blah")
28+
!43 = !{!49, !55}
29+
!49 = !DILocalVariable(name: "x", arg: 1, scope: !38, file: !17, line: 34, type: !41)
30+
!55 = !DILocalVariable(name: "k", scope: !56, file: !17, line: 36, type: !41)
31+
!56 = distinct !DILexicalBlock(scope: !38, file: !17, line: 36, column: 9)
32+
!70 = !DILocation(line: 36, column: 9, scope: !56)

llvm/test/DebugInfo/COFF/lines-bb-start.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ return: ; preds = %if.end, %if.then
9090
; CHECK: .cv_loc {{.*}} # t.c:4:5
9191
; CHECK: jmp LBB{{.*}}
9292
; CHECK: LBB2_{{.*}}: # %if.end
93+
; CHECK-NEXT: L{{.*}}:
94+
; CHECK-NEXT: DEBUG_VALUE: lea_dbg_value:
9395
; CHECK-NEXT: .cv_loc {{.*}} # t.c:5:3
9496
; CHECK: leal 4(%esp), %[[reg:[^ ]*]]
9597
; CHECK: movl %[[reg]], (%esp)

0 commit comments

Comments
 (0)