mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Make Builtin.canBeClass return a tri-state
Replace the true/maybe state that Builtin.canBeClass was returning by a tri-state (yes, no, maybe) allowing the optimizer to use the definite no answer. This removes the need of the sizeof check that we had in isClassOrObjCExistential. It also removes the need to CSE this function since in most cases we will be able to instantiate canBeClass to yes or no (vs maybe) at compile time. benchmark``````````````,``baserun0``,``optrun2``,``delta,``speedup ClassArrayGetter```````,``988.00````,``337.00```,``644.00``,````````191.7% DeltaBlue``````````````,``2429.00```,``1927.00``,``460.00``,````````23.9% Dictionary`````````````,``1374.00```,``1231.00``,``129.00``,````````10.9% Havlak`````````````````,``1079.00```,``911.00```,``124.00``,````````13.7% Rectangles`````````````,``924.00````,``541.00```,``379.00``,````````70.1% radar://16823238 Swift SVN r21331
This commit is contained in:
@@ -1047,10 +1047,10 @@ SILInstruction *SILCombiner::optimizeBuiltinCanBeObjCClass(ApplyInst *AI) {
|
||||
switch (Ty->canBeClass()) {
|
||||
case TypeTraitResult::IsNot:
|
||||
return IntegerLiteralInst::create(AI->getLoc(), AI->getType(),
|
||||
APInt(1, 0), *AI->getFunction());
|
||||
APInt(8, 0), *AI->getFunction());
|
||||
case TypeTraitResult::Is:
|
||||
return IntegerLiteralInst::create(AI->getLoc(), AI->getType(),
|
||||
APInt(1, 1), *AI->getFunction());
|
||||
APInt(8, 1), *AI->getFunction());
|
||||
case TypeTraitResult::CanBe:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user