Skip to content

Commit 542cacf

Browse files
committed
[sil-combine] Enable builtin visitors.
1 parent 7624d73 commit 542cacf

File tree

2 files changed

+195
-166
lines changed

2 files changed

+195
-166
lines changed

lib/SILOptimizer/SILCombiner/SILCombinerBuiltinVisitors.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,18 @@ SILInstruction *SILCombiner::optimizeBuiltinCOWBufferForReading(BuiltinInst *BI)
138138
RTAI->setImmutable();
139139
break;
140140
}
141-
case SILInstructionKind::StrongReleaseInst:
142-
cast<StrongReleaseInst>(user)->setOperand(ref);
143-
break;
144-
default:
145-
break;
141+
case SILInstructionKind::DestroyValueInst:
142+
cast<DestroyValueInst>(user)->setOperand(ref);
143+
break;
144+
case SILInstructionKind::StrongReleaseInst:
145+
cast<StrongReleaseInst>(user)->setOperand(ref);
146+
break;
147+
default:
148+
break;
146149
}
147150
useIter = nextIter;
148151
}
152+
149153
// If there are unknown users, keep the builtin, and IRGen will handle it.
150154
if (BI->use_empty())
151155
return eraseInstFromFunction(*BI);
@@ -577,9 +581,6 @@ SILInstruction *SILCombiner::optimizeStringObject(BuiltinInst *BI) {
577581
}
578582

579583
SILInstruction *SILCombiner::visitBuiltinInst(BuiltinInst *I) {
580-
if (I->getFunction()->hasOwnership())
581-
return nullptr;
582-
583584
if (I->getBuiltinInfo().ID == BuiltinValueKind::CanBeObjCClass)
584585
return optimizeBuiltinCanBeObjCClass(I);
585586
if (I->getBuiltinInfo().ID == BuiltinValueKind::IsConcrete)

0 commit comments

Comments
 (0)