Skip to content

Commit c6865c0

Browse files
authored
Merge pull request #19786 from atrick/silcloner-cleanup
SILCloner and SILInliner rewrite.
2 parents 76e6c41 + 9e440d1 commit c6865c0

22 files changed

+1723
-1530
lines changed

include/swift/SIL/DebugUtils.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ inline SILInstruction *getSingleNonDebugUser(SILValue V) {
169169
/// Erases the instruction \p I from it's parent block and deletes it, including
170170
/// all debug instructions which use \p I.
171171
/// Precondition: The instruction may only have debug instructions as uses.
172-
/// If the iterator \p InstIter references any deleted debug instruction, it is
172+
/// If the iterator \p InstIter references any deleted instruction, it is
173173
/// incremented.
174174
inline void eraseFromParentWithDebugInsts(SILInstruction *I,
175175
SILBasicBlock::iterator &InstIter) {
@@ -183,16 +183,17 @@ inline void eraseFromParentWithDebugInsts(SILInstruction *I,
183183
foundAny = true;
184184
auto *User = result->use_begin()->getUser();
185185
assert(User->isDebugInstruction());
186-
if (InstIter != SILBasicBlock::iterator() &&
187-
InstIter != I->getParent()->end() &&
188-
&*InstIter == User) {
186+
if (InstIter == User->getIterator())
189187
InstIter++;
190-
}
188+
191189
User->eraseFromParent();
192190
}
193191
}
194192
} while (foundAny);
195193

194+
if (InstIter == I->getIterator())
195+
++InstIter;
196+
196197
I->eraseFromParent();
197198
}
198199

0 commit comments

Comments
 (0)