Skip to content

Commit 2ececec

Browse files
authored
Merge pull request #27439 from gottesmm/pr-26e70f126cf7c922fa4d390617b799b8f5c7ca02
[debug-utils] Split deleteAllDebugUses(ValueBase *) into SILValue and…
2 parents 439361e + 471c747 commit 2ececec

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

include/swift/SIL/DebugUtils.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,22 @@
4242
namespace swift {
4343

4444
class SILInstruction;
45-
46-
/// Deletes all of the debug instructions that use \p Inst.
47-
inline void deleteAllDebugUses(ValueBase *Inst) {
48-
for (auto UI = Inst->use_begin(), E = Inst->use_end(); UI != E;) {
49-
auto *Inst = UI->getUser();
50-
UI++;
51-
if (Inst->isDebugInstruction())
52-
Inst->eraseFromParent();
45+
46+
/// Deletes all of the debug instructions that use \p value.
47+
inline void deleteAllDebugUses(SILValue value) {
48+
for (auto ui = value->use_begin(), ue = value->use_end(); ui != ue;) {
49+
auto *inst = ui->getUser();
50+
++ui;
51+
if (inst->isDebugInstruction()) {
52+
inst->eraseFromParent();
53+
}
54+
}
55+
}
56+
57+
/// Deletes all of the debug uses of any result of \p inst.
58+
inline void deleteAllDebugUses(SILInstruction *inst) {
59+
for (SILValue v : inst->getResults()) {
60+
deleteAllDebugUses(v);
5361
}
5462
}
5563

0 commit comments

Comments
 (0)