mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Optimizer: make the hasOwnershipOperandsOrResults utility available in OwnershipOptUtils
This commit is contained in:
@@ -1951,3 +1951,18 @@ void swift::replacePhisWithIncomingValues(SILPassManager *pm, ArrayRef<SILPhiArg
|
||||
}
|
||||
replacePhisWithIncomingValuesFunction({pm->getSwiftPassInvocation()}, ArrayRef(bridgedPhis));
|
||||
}
|
||||
|
||||
bool swift::hasOwnershipOperandsOrResults(SILInstruction *inst) {
|
||||
if (!inst->getFunction()->hasOwnership())
|
||||
return false;
|
||||
|
||||
for (SILValue result : inst->getResults()) {
|
||||
if (result->getOwnershipKind() != OwnershipKind::None)
|
||||
return true;
|
||||
}
|
||||
for (Operand &op : inst->getAllOperands()) {
|
||||
if (op.get()->getOwnershipKind() != OwnershipKind::None)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user