Don't sink open_existential instructions.

We don't sink open_existential_* instructions, because there may be some instructions depending on them, e.g. ametatype_inst, etc. But this kind of dependency cannot be expressed in SIL as a use yet. As a result, sinking open_existential may break the invariant that these instructions should dominate their uses.
This commit is contained in:
Roman Levenstein
2016-05-12 10:51:52 -07:00
parent 2eff3a1e9b
commit 1494d155c6
2 changed files with 39 additions and 0 deletions

View File

@@ -67,6 +67,19 @@ public:
if (II->isAllocatingStack() || II->isDeallocatingStack())
return false;
// We don't sink open_existential_* instructions, because
// there may be some instructions depending on them, e.g.
// metatype_inst, etc. But this kind of dependency
// cannot be expressed in SIL yet.
switch (II->getKind()) {
default: break;
case ValueKind::OpenExistentialBoxInst:
case ValueKind::OpenExistentialRefInst:
case ValueKind::OpenExistentialAddrInst:
case ValueKind::OpenExistentialMetatypeInst:
return false;
}
SILBasicBlock *CurrentBlock = II->getParent();
SILBasicBlock *Dest = nullptr;
unsigned InitialLoopDepth = LoopInfo->getLoopDepth(CurrentBlock);