Merge pull request #8090 from shajrawi/ConsumptionKind_UnconditionalCheckedCastValue

Add consumption kind to UnconditionalCheckedCastValueInst
This commit is contained in:
Joe Shajrawi
2017-03-14 15:30:26 -07:00
committed by GitHub
17 changed files with 80 additions and 36 deletions

View File

@@ -1930,10 +1930,12 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB,
break;
}
case ValueKind::UnconditionalCheckedCastValueInst: {
CastConsumptionKind consumption = getCastConsumptionKind(Attr);
SILValue Val = getLocalValue(
ValID, getSILType(MF->getType(TyID2), (SILValueCategory)TyCategory2));
SILType Ty = getSILType(MF->getType(TyID), (SILValueCategory)TyCategory);
ResultVal = Builder.createUnconditionalCheckedCastValue(Loc, Val, Ty);
ResultVal =
Builder.createUnconditionalCheckedCastValue(Loc, consumption, Val, Ty);
break;
}
case ValueKind::UnconditionalCheckedCastAddrInst:

View File

@@ -1313,7 +1313,8 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
auto CI = cast<UnconditionalCheckedCastValueInst>(&SI);
SILInstCastLayout::emitRecord(
Out, ScratchRecord, SILAbbrCodes[SILInstCastLayout::Code],
(unsigned)SI.getKind(), /*attr*/ 0,
(unsigned)SI.getKind(),
toStableCastConsumptionKind(CI->getConsumptionKind()),
S.addTypeRef(CI->getType().getSwiftRValueType()),
(unsigned)CI->getType().getCategory(),
S.addTypeRef(CI->getOperand()->getType().getSwiftRValueType()),