Skip to content

Commit 95af4ec

Browse files
committed
[sil-optimizer] Remove the opened archetypes related workarounds which are obsolete now.
Now we properly track the dependencies between instructions using opened archetypes and instructions opening those archetypes. No need for any special handling anymore.
1 parent 9d4fc91 commit 95af4ec

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

lib/SILOptimizer/LoopTransforms/LICM.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,6 @@ static bool canHoistInstruction(SILInstruction *Inst, SILLoop *Loop,
231231
if (isa<AllocationInst>(Inst) || isa<DeallocStackInst>(Inst))
232232
return false;
233233

234-
// Can't hoist metatype instruction referring to an opened existential,
235-
// because it may break the dominance relationship.
236-
if (isa<MetatypeInst>(Inst) &&
237-
Inst->getType().getSwiftRValueType()->hasOpenedExistential()) {
238-
return false;
239-
}
240-
241234
// Can't hoist instructions which may have side effects.
242235
if (!hasNoSideEffect(Inst, SafeReads))
243236
return false;

lib/SILOptimizer/Transforms/Sink.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,6 @@ class CodeSinkingPass : public SILFunctionTransform {
6767
if (II->isAllocatingStack() || II->isDeallocatingStack())
6868
return false;
6969

70-
// We don't sink open_existential_* instructions, because
71-
// there may be some instructions depending on them, e.g.
72-
// metatype_inst, etc. But this kind of dependency
73-
// cannot be expressed in SIL yet.
74-
switch (II->getKind()) {
75-
default: break;
76-
case ValueKind::OpenExistentialBoxInst:
77-
case ValueKind::OpenExistentialRefInst:
78-
case ValueKind::OpenExistentialAddrInst:
79-
case ValueKind::OpenExistentialMetatypeInst:
80-
return false;
81-
}
82-
8370
SILBasicBlock *CurrentBlock = II->getParent();
8471
SILBasicBlock *Dest = nullptr;
8572
unsigned InitialLoopDepth = LoopInfo->getLoopDepth(CurrentBlock);

0 commit comments

Comments
 (0)