Skip to content

Sundry fixes #16487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/IRGen/GenEnum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5109,8 +5109,7 @@ EnumImplStrategy::get(TypeConverter &TC, SILType type, EnumDecl *theEnum) {
origArgType = theEnum->mapTypeIntoContext(origArgType);

auto origArgLoweredTy = TC.IGM.getLoweredType(origArgType);
auto origArgTI = TC.tryGetCompleteTypeInfo(origArgLoweredTy.getASTType());
assert(origArgTI && "didn't complete type info?!");
auto *origArgTI = &TC.getCompleteTypeInfo(origArgLoweredTy.getASTType());

// If the unsubstituted argument contains a generic parameter type, or
// is not fixed-size in all resilience domains that have knowledge of
Expand Down
1 change: 0 additions & 1 deletion lib/IRGen/GenRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,6 @@ class RecordTypeBuilder {
auto &astField = astFields[i];
// Compute the field's type info.
auto &fieldTI = IGM.getTypeInfo(asImpl()->getType(astField));
assert(fieldTI.isComplete());
fieldTypesForLayout.push_back(&fieldTI);

fields.push_back(FieldImpl(asImpl()->getFieldInfo(i, astField, fieldTI)));
Expand Down
12 changes: 1 addition & 11 deletions lib/IRGen/GenType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1365,17 +1365,7 @@ const TypeInfo &IRGenModule::getTypeInfoForLowered(CanType T) {
const TypeInfo &TypeConverter::getCompleteTypeInfo(CanType T) {
auto entry = getTypeEntry(T);
assert(entry.is<const TypeInfo*>() && "getting TypeInfo recursively!");
auto &ti = *entry.get<const TypeInfo*>();
assert(ti.isComplete());
return ti;
}

const TypeInfo *TypeConverter::tryGetCompleteTypeInfo(CanType T) {
auto entry = getTypeEntry(T);
if (!entry.is<const TypeInfo*>()) return nullptr;
auto &ti = *entry.get<const TypeInfo*>();
if (!ti.isComplete()) return nullptr;
return &ti;
return *entry.get<const TypeInfo*>();
}

ArchetypeType *TypeConverter::getExemplarArchetype(ArchetypeType *t) {
Expand Down
1 change: 0 additions & 1 deletion lib/IRGen/GenType.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class TypeConverter {

TypeCacheEntry getTypeEntry(CanType type);
const TypeInfo &getCompleteTypeInfo(CanType type);
const TypeInfo *tryGetCompleteTypeInfo(CanType type);
const LoadableTypeInfo &getNativeObjectTypeInfo();
const LoadableTypeInfo &getUnknownObjectTypeInfo();
const LoadableTypeInfo &getBridgeObjectTypeInfo();
Expand Down
12 changes: 2 additions & 10 deletions lib/IRGen/TypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ class TypeInfo {

friend class TypeConverter;

enum : unsigned { InvalidAlignmentShift = 63 };

protected:
union {
uint64_t OpaqueBits;
Expand Down Expand Up @@ -144,10 +142,10 @@ class TypeInfo {
IsFixedSize_t alwaysFixedSize,
SpecialTypeInfoKind stik) : StorageType(Type) {
assert(stik >= SpecialTypeInfoKind::Fixed || !alwaysFixedSize);
assert(!A.isZero() && "Invalid alignment");
Bits.OpaqueBits = 0;
Bits.TypeInfo.Kind = unsigned(stik);
Bits.TypeInfo.AlignmentShift = A.isZero() ? InvalidAlignmentShift
: llvm::Log2_32(A.getValue());
Bits.TypeInfo.AlignmentShift = llvm::Log2_32(A.getValue());
Bits.TypeInfo.POD = pod;
Bits.TypeInfo.BitwiseTakable = bitwiseTakable;
Bits.TypeInfo.SubclassKind = InvalidSubclassKind;
Expand Down Expand Up @@ -188,11 +186,6 @@ class TypeInfo {
return static_cast<const T &>(*this);
}

/// Whether this type info has been completely converted.
bool isComplete() const {
return Bits.TypeInfo.AlignmentShift != InvalidAlignmentShift;
}

/// Whether this type is known to be empty.
bool isKnownEmpty(ResilienceExpansion expansion) const;

Expand Down Expand Up @@ -263,7 +256,6 @@ class TypeInfo {

Alignment getBestKnownAlignment() const {
auto Shift = Bits.TypeInfo.AlignmentShift;
assert(Shift != InvalidAlignmentShift);
return Alignment(1ull << Shift);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/SIL/SILInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ SILInstructionResultArray::SILInstructionResultArray(
auto TRangeBegin = TypedRange.begin();
auto TRangeIter = TRangeBegin;
auto TRangeEnd = TypedRange.end();
assert(MVResults.size() == unsigned(std::distance(VRangeBegin, VRangeEnd)));
assert(MVResults.size() == unsigned(std::distance(TRangeBegin, TRangeEnd)));
for (unsigned i : indices(MVResults)) {
assert(SILValue(&MVResults[i]) == (*this)[i]);
assert(SILValue(&MVResults[i])->getType() == (*this)[i]->getType());
Expand Down
1 change: 0 additions & 1 deletion lib/SILOptimizer/SILCombiner/SILCombinerCastVisitors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ visitPointerToAddressInst(PointerToAddressInst *PTAI) {
SILInstruction *
SILCombiner::visitUncheckedAddrCastInst(UncheckedAddrCastInst *UADCI) {
Builder.setCurrentDebugScope(UADCI->getDebugScope());
SILModule &Mod = UADCI->getModule();

// (unchecked-addr-cast (unchecked-addr-cast x X->Y) Y->Z)
// ->
Expand Down