mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Remove redundant SILType::isMoveOnlyNominalType (NFC)
and implement `SILType::isPureMoveOnly` in terms of `Type::isPureMoveOnly`.
This commit is contained in:
@@ -69,11 +69,15 @@ static bool performTransform(SILFunction &fn) {
|
||||
|
||||
if (auto *dvi = dyn_cast<DestroyValueInst>(inst)) {
|
||||
auto destroyType = dvi->getOperand()->getType();
|
||||
if (destroyType.isMoveOnlyNominalType() &&
|
||||
if (destroyType.isPureMoveOnly() &&
|
||||
!isa<DropDeinitInst>(lookThroughOwnershipInsts(dvi->getOperand()))) {
|
||||
LLVM_DEBUG(llvm::dbgs() << "Handling: " << *dvi);
|
||||
auto *nom = destroyType.getNominalOrBoundGenericNominal();
|
||||
assert(nom);
|
||||
if (!nom) {
|
||||
LLVM_DEBUG(llvm::dbgs()
|
||||
<< "Not a nominal type, so no deinit! Skipping!\n");
|
||||
continue;
|
||||
}
|
||||
auto *deinitFunc = mod.lookUpMoveOnlyDeinitFunction(nom);
|
||||
if (!deinitFunc) {
|
||||
LLVM_DEBUG(llvm::dbgs()
|
||||
@@ -108,11 +112,15 @@ static bool performTransform(SILFunction &fn) {
|
||||
|
||||
if (auto *dai = dyn_cast<DestroyAddrInst>(inst)) {
|
||||
auto destroyType = dai->getOperand()->getType();
|
||||
if (destroyType.isLoadable(fn) && destroyType.isMoveOnlyNominalType() &&
|
||||
if (destroyType.isLoadable(fn) && destroyType.isPureMoveOnly() &&
|
||||
!isa<DropDeinitInst>(dai->getOperand())) {
|
||||
LLVM_DEBUG(llvm::dbgs() << "Handling: " << *dai);
|
||||
auto *nom = destroyType.getNominalOrBoundGenericNominal();
|
||||
assert(nom);
|
||||
if (!nom) {
|
||||
LLVM_DEBUG(llvm::dbgs()
|
||||
<< "Not a nominal type, so no deinit! Skipping!\n");
|
||||
continue;
|
||||
}
|
||||
auto *deinitFunc = mod.lookUpMoveOnlyDeinitFunction(nom);
|
||||
if (!deinitFunc) {
|
||||
LLVM_DEBUG(llvm::dbgs()
|
||||
|
||||
Reference in New Issue
Block a user