mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen unconditional dynamic casts using the new
unconditional_dynamic_cast_addr instruction. Also, fix some major semantic problems with the existing specialization of unconditional dynamic casts by handling optional types and being much more conservative about deciding that a cast is infeasible. This commit regresses specialization slightly by failing to turn indirect dynamic casts into scalar ones when possible; we can fix that easily enough in a follow-up. Swift SVN r19044
This commit is contained in:
@@ -1272,6 +1272,19 @@ SILGenFunction::emitSubstToOrigValue(SILLocation loc, ManagedValue v,
|
||||
substFormalType, ctxt);
|
||||
}
|
||||
|
||||
ManagedValue
|
||||
SILGenFunction::emitRValueAsOrig(Expr *expr, AbstractionPattern origFormalType,
|
||||
const TypeLowering &origTL, SGFContext ctxt) {
|
||||
auto substFormalType = expr->getType()->getCanonicalType();
|
||||
auto &substTL = getTypeLowering(substFormalType);
|
||||
if (substTL.getLoweredType() == origTL.getLoweredType())
|
||||
return emitRValueAsSingleValue(expr, ctxt);
|
||||
|
||||
ManagedValue temp = emitRValueAsSingleValue(expr);
|
||||
return emitSubstToOrigValue(expr, temp, origFormalType,
|
||||
substFormalType, ctxt);
|
||||
}
|
||||
|
||||
ManagedValue RValueSource::materialize(SILGenFunction &SGF,
|
||||
AbstractionPattern origFormalType,
|
||||
SILType destType) && {
|
||||
|
||||
Reference in New Issue
Block a user