Restore CanType-based micro-optimizations.

This reverts commit 5036806e5a.
However, it preserves a pair of changes to the SIL optimizer
relating to walking through optional types.
This commit is contained in:
John McCall
2017-03-14 11:30:06 -04:00
parent f3bfc777be
commit 897f5ab7c5
15 changed files with 144 additions and 88 deletions

View File

@@ -2349,7 +2349,7 @@ public:
resultInstTy = cast<MetatypeType>(resultInstTy).getInstanceType();
}
require(operandInstTy->isExistentialType(),
require(operandInstTy.isExistentialType(),
"ill-formed existential metatype in open_existential_metatype "
"operand");
auto archetype = getOpenedArchetypeOf(resultInstTy);
@@ -2596,9 +2596,9 @@ public:
}
if (isExact) {
require(fromCanTy->getClassOrBoundGenericClass(),
require(fromCanTy.getClassOrBoundGenericClass(),
"downcast operand must be a class type");
require(toCanTy->getClassOrBoundGenericClass(),
require(toCanTy.getClassOrBoundGenericClass(),
"downcast must convert to a class type");
require(SILType::getPrimitiveObjectType(fromCanTy).
isBindableToSuperclassOf(SILType::getPrimitiveObjectType(toCanTy)),