Skip to content

Commit 11a5359

Browse files
authored
Merge pull request #73995 from Snowy1803/rdar126556557
[DebugInfo] [SILGen] Remove all invalid debug info from intermediates
2 parents 531469f + a530534 commit 11a5359

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

lib/SILGen/SILGenProlog.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,18 +1540,19 @@ uint16_t SILGenFunction::emitBasicProlog(
15401540
B.emitDebugDescription(loc, undef.getValue(), dbgVar);
15411541
}
15421542

1543-
for (auto &i : *B.getInsertionBB()) {
1544-
auto *alloc = dyn_cast<AllocStackInst>(&i);
1545-
if (!alloc)
1546-
continue;
1547-
auto varInfo = alloc->getVarInfo();
1548-
if (!varInfo || varInfo->ArgNo)
1549-
continue;
1550-
// The allocation has a varinfo but no argument number, which should not
1551-
// happen in the prolog. Unfortunately, some copies can generate wrong
1552-
// debug info, so we have to fix it here, by invalidating it.
1553-
alloc->invalidateVarInfo();
1554-
}
1543+
for (auto &bb : B.getFunction())
1544+
for (auto &i : bb) {
1545+
auto *alloc = dyn_cast<AllocStackInst>(&i);
1546+
if (!alloc)
1547+
continue;
1548+
auto varInfo = alloc->getVarInfo();
1549+
if (!varInfo || varInfo->ArgNo)
1550+
continue;
1551+
// The allocation has a varinfo but no argument number, which should not
1552+
// happen in the prolog. Unfortunately, some copies can generate wrong
1553+
// debug info, so we have to fix it here, by invalidating it.
1554+
alloc->invalidateVarInfo();
1555+
}
15551556

15561557
return ArgNo;
15571558
}

test/DebugInfo/parameter-pack.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
2+
3+
// https://github.com/apple/swift/issues/73030
4+
5+
// CHECK-LABEL: sil {{.+}} @$s4main1f1t1cxxQp_q_t_q0_txxQp_t_q_t_q0_tRvzr1_lF
6+
func f<each A, B, C>(t: ((repeat each A), B), c: C) -> ((repeat each A, B), C) {
7+
// CHECK-NOT: let, name "t"
8+
// CHECK: alloc_stack [lexical] [var_decl] $((repeat each A), B), let, name "t", argno 1
9+
// CHECK: debug_value %{{[0-9]+}} : $*C, let, name "c", argno 2, expr op_deref
10+
((repeat each t.0, t.1), c)
11+
}

0 commit comments

Comments
 (0)