Skip to content

Commit 014f6f3

Browse files
authored
Merge pull request #16487 from slavapestov/sundry-fixes
Sundry fixes
2 parents ec3fade + 4058b8a commit 014f6f3

File tree

7 files changed

+5
-27
lines changed

7 files changed

+5
-27
lines changed

lib/IRGen/GenEnum.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5109,8 +5109,7 @@ EnumImplStrategy::get(TypeConverter &TC, SILType type, EnumDecl *theEnum) {
51095109
origArgType = theEnum->mapTypeIntoContext(origArgType);
51105110

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

51155114
// If the unsubstituted argument contains a generic parameter type, or
51165115
// is not fixed-size in all resilience domains that have knowledge of

lib/IRGen/GenRecord.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ class RecordTypeBuilder {
524524
auto &astField = astFields[i];
525525
// Compute the field's type info.
526526
auto &fieldTI = IGM.getTypeInfo(asImpl()->getType(astField));
527-
assert(fieldTI.isComplete());
528527
fieldTypesForLayout.push_back(&fieldTI);
529528

530529
fields.push_back(FieldImpl(asImpl()->getFieldInfo(i, astField, fieldTI)));

lib/IRGen/GenType.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,17 +1365,7 @@ const TypeInfo &IRGenModule::getTypeInfoForLowered(CanType T) {
13651365
const TypeInfo &TypeConverter::getCompleteTypeInfo(CanType T) {
13661366
auto entry = getTypeEntry(T);
13671367
assert(entry.is<const TypeInfo*>() && "getting TypeInfo recursively!");
1368-
auto &ti = *entry.get<const TypeInfo*>();
1369-
assert(ti.isComplete());
1370-
return ti;
1371-
}
1372-
1373-
const TypeInfo *TypeConverter::tryGetCompleteTypeInfo(CanType T) {
1374-
auto entry = getTypeEntry(T);
1375-
if (!entry.is<const TypeInfo*>()) return nullptr;
1376-
auto &ti = *entry.get<const TypeInfo*>();
1377-
if (!ti.isComplete()) return nullptr;
1378-
return &ti;
1368+
return *entry.get<const TypeInfo*>();
13791369
}
13801370

13811371
ArchetypeType *TypeConverter::getExemplarArchetype(ArchetypeType *t) {

lib/IRGen/GenType.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ class TypeConverter {
138138

139139
TypeCacheEntry getTypeEntry(CanType type);
140140
const TypeInfo &getCompleteTypeInfo(CanType type);
141-
const TypeInfo *tryGetCompleteTypeInfo(CanType type);
142141
const LoadableTypeInfo &getNativeObjectTypeInfo();
143142
const LoadableTypeInfo &getUnknownObjectTypeInfo();
144143
const LoadableTypeInfo &getBridgeObjectTypeInfo();

lib/IRGen/TypeInfo.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ class TypeInfo {
9292

9393
friend class TypeConverter;
9494

95-
enum : unsigned { InvalidAlignmentShift = 63 };
96-
9795
protected:
9896
union {
9997
uint64_t OpaqueBits;
@@ -144,10 +142,10 @@ class TypeInfo {
144142
IsFixedSize_t alwaysFixedSize,
145143
SpecialTypeInfoKind stik) : StorageType(Type) {
146144
assert(stik >= SpecialTypeInfoKind::Fixed || !alwaysFixedSize);
145+
assert(!A.isZero() && "Invalid alignment");
147146
Bits.OpaqueBits = 0;
148147
Bits.TypeInfo.Kind = unsigned(stik);
149-
Bits.TypeInfo.AlignmentShift = A.isZero() ? InvalidAlignmentShift
150-
: llvm::Log2_32(A.getValue());
148+
Bits.TypeInfo.AlignmentShift = llvm::Log2_32(A.getValue());
151149
Bits.TypeInfo.POD = pod;
152150
Bits.TypeInfo.BitwiseTakable = bitwiseTakable;
153151
Bits.TypeInfo.SubclassKind = InvalidSubclassKind;
@@ -188,11 +186,6 @@ class TypeInfo {
188186
return static_cast<const T &>(*this);
189187
}
190188

191-
/// Whether this type info has been completely converted.
192-
bool isComplete() const {
193-
return Bits.TypeInfo.AlignmentShift != InvalidAlignmentShift;
194-
}
195-
196189
/// Whether this type is known to be empty.
197190
bool isKnownEmpty(ResilienceExpansion expansion) const;
198191

@@ -263,7 +256,6 @@ class TypeInfo {
263256

264257
Alignment getBestKnownAlignment() const {
265258
auto Shift = Bits.TypeInfo.AlignmentShift;
266-
assert(Shift != InvalidAlignmentShift);
267259
return Alignment(1ull << Shift);
268260
}
269261

lib/SIL/SILInstruction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ SILInstructionResultArray::SILInstructionResultArray(
13041304
auto TRangeBegin = TypedRange.begin();
13051305
auto TRangeIter = TRangeBegin;
13061306
auto TRangeEnd = TypedRange.end();
1307-
assert(MVResults.size() == unsigned(std::distance(VRangeBegin, VRangeEnd)));
1307+
assert(MVResults.size() == unsigned(std::distance(TRangeBegin, TRangeEnd)));
13081308
for (unsigned i : indices(MVResults)) {
13091309
assert(SILValue(&MVResults[i]) == (*this)[i]);
13101310
assert(SILValue(&MVResults[i])->getType() == (*this)[i]->getType());

lib/SILOptimizer/SILCombiner/SILCombinerCastVisitors.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ visitPointerToAddressInst(PointerToAddressInst *PTAI) {
192192
SILInstruction *
193193
SILCombiner::visitUncheckedAddrCastInst(UncheckedAddrCastInst *UADCI) {
194194
Builder.setCurrentDebugScope(UADCI->getDebugScope());
195-
SILModule &Mod = UADCI->getModule();
196195

197196
// (unchecked-addr-cast (unchecked-addr-cast x X->Y) Y->Z)
198197
// ->

0 commit comments

Comments
 (0)