Skip to content

Commit 2726d83

Browse files
committed
[IRGenDebugInfo] Allow multiple dbg.declare on an alloca
This is unnecessarily dropping debug info, as there is currently no assertion in LLVM. The sharing of stack slot can happen because of AllocStackHoisting, which is run at -Onone too.
1 parent e1a82f6 commit 2726d83

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,11 +3411,6 @@ void IRGenDebugInfoImpl::emitDbgIntrinsic(
34113411
auto DL =
34123412
llvm::DILocation::get(IGM.getLLVMContext(), Line, Col, Scope, InlinedAt);
34133413

3414-
// An alloca may only be described by exactly one dbg.declare.
3415-
if (isa<llvm::AllocaInst>(Storage) &&
3416-
!llvm::FindDbgDeclareUses(Storage).empty())
3417-
return;
3418-
34193414
// Fragment DIExpression cannot cover the whole variable
34203415
// or going out-of-bound.
34213416
if (auto Fragment = Expr->getFragmentInfo()) {

test/DebugInfo/inlined-generics-basic.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class C<R> {
5252
// SIL: function_ref {{.*}}use{{.*}} scope [[F1G3H]]
5353
// IR: dbg.value(metadata ptr %[[ARG_S]], metadata ![[MD_1_0:[0-9]+]]
5454
// IR: %[[RS_PAIR:.*]] = alloca i8, i{{.*}} %
55+
// IR: dbg.declare(metadata ptr %[[RS_PAIR]], metadata ![[GRS_U:[0-9]+]],
5556
// IR: dbg.declare(metadata ptr %[[RS_PAIR]], metadata ![[GRS_T:[0-9]+]],
5657
// IR: dbg.value(metadata ptr %[[ARG_0]], metadata ![[S:[0-9]+]]
5758
// IR: dbg.value(metadata ptr %[[ARG_0]], metadata ![[GS_T:[0-9]+]]
@@ -100,6 +101,8 @@ public class C<R> {
100101
// IR-DAG: ![[MD_1_0]] = !DILocalVariable(name: "$\CF\84_1_0"
101102
// IR-DAG: ![[GRS_T]] = !DILocalVariable(name: "t", {{.*}} scope: ![[SP_GRS_T:[0-9]+]], {{.*}}type: ![[LET_TUPLE:[0-9]+]]
102103
// IR-DAG: ![[SP_GRS_T]] = {{.*}}linkageName: "$s1A1gyyxlFx_qd__t_Ti5"
104+
// IR-DAG: ![[GRS_U]] = !DILocalVariable(name: "u", {{.*}} scope: ![[SP_GRS_U:[0-9]+]], {{.*}}type: ![[LET_TUPLE:[0-9]+]]
105+
// IR-DAG: ![[SP_GRS_U]] = {{.*}}linkageName: "$s1A1hyyxlFx_qd__t_Ti5"
103106
// IR-DAG: ![[LET_TUPLE]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: ![[TUPLE:[0-9]+]])
104107
// IR-DAG: ![[TUPLE]] = {{.*}}DW_TAG_structure_type, name: "$sx_qd__tD"
105108
// IR-DAG: ![[S]] = !DILocalVariable(name: "s", {{.*}} type: ![[LET_TAU_1_0:[0-9]+]]

0 commit comments

Comments
 (0)