mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix several incorrect uses of ApplySite::getArgumentConvention.
At least most of these were latent bugs since the code was unreachable in the PartialApply case. But that's no excuse to misuse the API. Also, whenever referring to an integer index, be explicit about whether it is an applied argument or callee argument.
This commit is contained in:
@@ -284,7 +284,7 @@ static bool partialApplyEscapes(SILValue V, bool examineApply) {
|
||||
SILModuleConventions ModConv(*V->getModule());
|
||||
llvm::SmallVector<Operand *, 32> Worklist(V->use_begin(), V->use_end());
|
||||
while (!Worklist.empty()) {
|
||||
auto *Op = Worklist.pop_back_val();
|
||||
Operand *Op = Worklist.pop_back_val();
|
||||
|
||||
// These instructions do not cause the address to escape.
|
||||
if (!useCaptured(Op))
|
||||
@@ -300,15 +300,14 @@ static bool partialApplyEscapes(SILValue V, bool examineApply) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto *Apply = dyn_cast<ApplyInst>(User)) {
|
||||
if (auto Apply = FullApplySite::isa(User)) {
|
||||
// Applying a function does not cause the function to escape.
|
||||
if (Op->getOperandNumber() == 0)
|
||||
if (!Apply.isArgumentOperand(*Op))
|
||||
continue;
|
||||
|
||||
// apply instructions do not capture the pointer when it is passed
|
||||
// indirectly
|
||||
if (Apply->getArgumentConvention(Op->getOperandNumber() - 1)
|
||||
.isIndirectConvention())
|
||||
if (Apply.getArgumentConvention(*Op).isIndirectConvention())
|
||||
continue;
|
||||
|
||||
// Optionally drill down into an apply to see if the operand is
|
||||
|
||||
Reference in New Issue
Block a user