mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SILInstruction] Introduce isDebugInstruction().
This is a property of an instruction and should be a member function of `SILInstruction` and not a free function in `DebugUtils`. Discussed with Adrian.
This commit is contained in:
@@ -43,18 +43,12 @@ namespace swift {
|
||||
|
||||
class SILInstruction;
|
||||
|
||||
/// Returns true if the instruction \p Inst is an instruction which is only
|
||||
/// relevant for debug information and has no other impact on program semantics.
|
||||
inline bool isDebugInst(SILInstruction *Inst) {
|
||||
return isa<DebugValueInst>(Inst) || isa<DebugValueAddrInst>(Inst);
|
||||
}
|
||||
|
||||
/// Deletes all of the debug instructions that use \p Inst.
|
||||
inline void deleteAllDebugUses(ValueBase *Inst) {
|
||||
for (auto UI = Inst->use_begin(), E = Inst->use_end(); UI != E;) {
|
||||
auto *Inst = UI->getUser();
|
||||
UI++;
|
||||
if (isDebugInst(Inst))
|
||||
if (Inst->isDebugInstruction())
|
||||
Inst->eraseFromParent();
|
||||
}
|
||||
}
|
||||
@@ -76,7 +70,7 @@ template <bool nonDebugInsts> class DebugUseIterator
|
||||
return;
|
||||
|
||||
SILInstruction *User = BaseIterator->getUser();
|
||||
if (isDebugInst(User) != nonDebugInsts)
|
||||
if (User->isDebugInstruction() != nonDebugInsts)
|
||||
return;
|
||||
|
||||
BaseIterator++;
|
||||
@@ -188,7 +182,7 @@ inline void eraseFromParentWithDebugInsts(SILInstruction *I,
|
||||
while (!result->use_empty()) {
|
||||
foundAny = true;
|
||||
auto *User = result->use_begin()->getUser();
|
||||
assert(isDebugInst(User));
|
||||
assert(User->isDebugInstruction());
|
||||
if (InstIter != SILBasicBlock::iterator() &&
|
||||
InstIter != I->getParent()->end() &&
|
||||
&*InstIter == User) {
|
||||
|
||||
Reference in New Issue
Block a user