mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[verifier] Make sure that applies of no-return functions have an unreachable as the next instruction.
This makes it easy to find no-return functions since one must iterate through all BB with unreachable terminators and check the previous instruction. Swift SVN r25004
This commit is contained in:
@@ -74,6 +74,11 @@ static bool canApplyDecrementRefCount(ApplyInst *AI, SILValue Ptr,
|
||||
if (FTy->getExtInfo().hasContext())
|
||||
return true;
|
||||
|
||||
// Treat applications of @noreturn functions as decrementing ref counts. This
|
||||
// causes the apply to become a sink barrier for ref count increments.
|
||||
if (AI->getCallee().getType().getAs<SILFunctionType>()->isNoReturn())
|
||||
return true;
|
||||
|
||||
// swift_keepAlive can not retain values. Remove this when we get rid of that.
|
||||
if (auto *FRI = dyn_cast<FunctionRefInst>(AI->getCallee()))
|
||||
if (isKnownToNotDecrementRefCount(FRI))
|
||||
|
||||
Reference in New Issue
Block a user