Merge remote-tracking branch 'origin/master' into master-next

This commit is contained in:
swift-ci
2018-03-30 13:48:46 -07:00
21 changed files with 412 additions and 49 deletions

View File

@@ -1068,7 +1068,6 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB,
ONEOPERAND_ONETYPE_INST(ObjCMetatypeToObject)
ONEOPERAND_ONETYPE_INST(ObjCExistentialMetatypeToObject)
ONEOPERAND_ONETYPE_INST(ConvertFunction)
ONEOPERAND_ONETYPE_INST(ConvertEscapeToNoEscape)
ONEOPERAND_ONETYPE_INST(ThinFunctionToPointer)
ONEOPERAND_ONETYPE_INST(PointerToThinFunction)
ONEOPERAND_ONETYPE_INST(ProjectBlockStorage)
@@ -1084,6 +1083,18 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB,
TyID);
break;
}
case SILInstructionKind::ConvertEscapeToNoEscapeInst: {
assert(RecordKind == SIL_ONE_TYPE_ONE_OPERAND &&
"Layout should be OneTypeOneOperand.");
bool isLifetimeGuaranteed = Attr & 0x01;
ResultVal = Builder.createConvertEscapeToNoEscape(
Loc,
getLocalValue(ValID, getSILType(MF->getType(TyID2),
(SILValueCategory)TyCategory2)),
getSILType(MF->getType(TyID), (SILValueCategory)TyCategory),
isLifetimeGuaranteed);
break;
}
case SILInstructionKind::PointerToAddressInst: {
assert(RecordKind == SIL_ONE_TYPE_ONE_OPERAND &&

View File

@@ -252,7 +252,8 @@ namespace {
void writeSILBlock(const SILModule *SILMod);
void writeIndexTables();
void writeConversionLikeInstruction(const SingleValueInstruction *I);
void writeConversionLikeInstruction(const SingleValueInstruction *I,
bool guaranteed);
void writeOneTypeLayout(SILInstructionKind valueKind, SILType type);
void writeOneTypeOneOperandLayout(SILInstructionKind valueKind,
unsigned attrs,
@@ -581,9 +582,10 @@ void SILSerializer::writeOneTypeOneOperandLayout(SILInstructionKind valueKind,
/// Write an instruction that looks exactly like a conversion: all
/// important information is encoded in the operand and the result type.
void SILSerializer::writeConversionLikeInstruction(const SingleValueInstruction *I) {
void SILSerializer::writeConversionLikeInstruction(
const SingleValueInstruction *I, bool guaranteed) {
assert(I->getNumOperands() - I->getTypeDependentOperands().size() == 1);
writeOneTypeOneOperandLayout(I->getKind(), 0, I->getType(),
writeOneTypeOneOperandLayout(I->getKind(), guaranteed ? 1 : 0, I->getType(),
I->getOperand(0));
}
@@ -1448,7 +1450,11 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
case SILInstructionKind::ObjCMetatypeToObjectInst:
case SILInstructionKind::ObjCExistentialMetatypeToObjectInst:
case SILInstructionKind::ProjectBlockStorageInst: {
writeConversionLikeInstruction(cast<SingleValueInstruction>(&SI));
bool guaranteed = false;
if (SI.getKind() == SILInstructionKind::ConvertEscapeToNoEscapeInst)
guaranteed = cast<ConvertEscapeToNoEscapeInst>(SI).isLifetimeGuaranteed();
writeConversionLikeInstruction(cast<SingleValueInstruction>(&SI),
guaranteed);
break;
}
case SILInstructionKind::PointerToAddressInst: {