mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Audit all SILPasses to ensure that new instructions are never created
without a valid SILDebugScope. An assertion in IRGenSIL prevents future optimizations from regressing in this regard. Introducing SILBuilderWithScope and SILBuilderwithPostprocess to ease the transition. This patch is large, but mostly mechanical. <rdar://problem/18494573> Swift: Debugger is not stopping at the set breakpoint Swift SVN r22978
This commit is contained in:
@@ -285,4 +285,39 @@ SILValue SILBuilder::emitObjCToThickMetatype(SILLocation Loc, SILValue Op,
|
||||
return createObjCToThickMetatype(Loc, Op, Ty);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
/// Determine whether an instruction may not have a SILDebugScope.
|
||||
bool swift::maybeScopeless(SILInstruction &I) {
|
||||
// This list is supposed to get ever shorter as we are tightening
|
||||
// the requirements for the optimizer.
|
||||
switch (I.getLoc().getKind()) {
|
||||
case SILLocation::CleanupKind:
|
||||
case SILLocation::ImplicitReturnKind:
|
||||
case SILLocation::ArtificialUnreachableKind:
|
||||
case SILLocation::SILFileKind:
|
||||
return true;
|
||||
default: break;
|
||||
}
|
||||
if (!I.getLoc().isNull() || I.getLoc().isAutoGenerated())
|
||||
return true;
|
||||
|
||||
switch (I.getKind()) {
|
||||
case ValueKind::BranchInst:
|
||||
case ValueKind::CondBranchInst:
|
||||
case ValueKind::DebugValueAddrInst:
|
||||
case ValueKind::DebugValueInst:
|
||||
case ValueKind::GlobalAddrInst:
|
||||
case ValueKind::ReleaseValueInst:
|
||||
case ValueKind::RetainValueInst:
|
||||
case ValueKind::StrongReleaseInst:
|
||||
case ValueKind::StrongRetainInst:
|
||||
case ValueKind::TupleInst:
|
||||
case ValueKind::UnreachableInst:
|
||||
return true;
|
||||
default: break;
|
||||
}
|
||||
|
||||
auto *Fn = I.getParent()->getParent();
|
||||
return Fn->isTransparent() || Fn->isBare();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user