Skip to content

Commit 4ede40e

Browse files
committed
[DebugInfo] Remove passing of the unused SizeIsFragmentSize (NFC)
1 parent 456b5a0 commit 4ede40e

File tree

5 files changed

+36
-70
lines changed

5 files changed

+36
-70
lines changed

include/swift/SIL/SILDebugInfoExpression.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,6 @@ class SILDebugInfoExpression {
296296
return Elements.size() &&
297297
Elements[0].getAsOperator() == SILDIExprOperator::Dereference;
298298
}
299-
300-
/// Return true if this DIExpression has a fragment (at the end)
301-
bool hasFragment() const {
302-
return (Elements.size() >= 2 &&
303-
Elements[Elements.size() - 2].getAsOperator() ==
304-
SILDIExprOperator::Fragment) ||
305-
(Elements.size() >= 3 &&
306-
Elements[Elements.size() - 3].getAsOperator() ==
307-
SILDIExprOperator::TupleFragment);
308-
}
309299
};
310300

311301
/// Returns the hashcode for the di expr element.

lib/IRGen/DebugTypeInfo.cpp

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ using namespace irgen;
2727

2828
DebugTypeInfo::DebugTypeInfo(swift::Type Ty, llvm::Type *FragmentStorageTy,
2929
Alignment Align, bool HasDefaultAlignment,
30-
bool IsMetadata, bool SizeIsFragmentSize,
31-
bool IsFixedBuffer,
30+
bool IsMetadata, bool IsFixedBuffer,
3231
std::optional<uint32_t> NumExtraInhabitants)
3332
: Type(Ty.getPointer()), FragmentStorageType(FragmentStorageTy),
3433
NumExtraInhabitants(NumExtraInhabitants),
3534
Align(Align), DefaultAlignment(HasDefaultAlignment),
36-
IsMetadataType(IsMetadata), SizeIsFragmentSize(SizeIsFragmentSize),
37-
IsFixedBuffer(IsFixedBuffer) {
35+
IsMetadataType(IsMetadata), IsFixedBuffer(IsFixedBuffer) {
3836
assert(Align.getValue() != 0);
3937
}
4038

@@ -49,8 +47,7 @@ static bool hasDefaultAlignment(swift::Type Ty) {
4947
}
5048

5149
DebugTypeInfo DebugTypeInfo::getFromTypeInfo(swift::Type Ty, const TypeInfo &TI,
52-
IRGenModule &IGM,
53-
bool IsFragmentTypeInfo) {
50+
IRGenModule &IGM) {
5451
llvm::Type *StorageType = TI.getStorageType();
5552
std::optional<uint32_t> NumExtraInhabitants;
5653
if (TI.isFixedSize()) {
@@ -60,13 +57,12 @@ DebugTypeInfo DebugTypeInfo::getFromTypeInfo(swift::Type Ty, const TypeInfo &TI,
6057
assert(TI.getStorageType() && "StorageType is a nullptr");
6158
return DebugTypeInfo(Ty.getPointer(), StorageType,
6259
TI.getBestKnownAlignment(), ::hasDefaultAlignment(Ty),
63-
false, IsFragmentTypeInfo, false, NumExtraInhabitants);
60+
false, false, NumExtraInhabitants);
6461
}
6562

6663
DebugTypeInfo DebugTypeInfo::getLocalVariable(VarDecl *Decl, swift::Type Ty,
6764
const TypeInfo &Info,
68-
IRGenModule &IGM,
69-
bool IsFragmentTypeInfo) {
65+
IRGenModule &IGM) {
7066

7167
auto DeclType = Decl->getInterfaceType();
7268
auto RealType = Ty;
@@ -80,13 +76,13 @@ DebugTypeInfo DebugTypeInfo::getLocalVariable(VarDecl *Decl, swift::Type Ty,
8076
// the type hasn't been mucked with by an optimization pass.
8177
auto *Type = Sugared->isEqual(RealType) ? DeclType.getPointer()
8278
: RealType.getPointer();
83-
return getFromTypeInfo(Type, Info, IGM, IsFragmentTypeInfo);
79+
return getFromTypeInfo(Type, Info, IGM);
8480
}
8581

8682
DebugTypeInfo DebugTypeInfo::getGlobalMetadata(swift::Type Ty,
8783
llvm::Type *StorageTy, Size size,
8884
Alignment align) {
89-
DebugTypeInfo DbgTy(Ty.getPointer(), StorageTy, align, true, false, false);
85+
DebugTypeInfo DbgTy(Ty.getPointer(), StorageTy, align, true, false);
9086
assert(StorageTy && "StorageType is a nullptr");
9187
assert(!DbgTy.isContextArchetype() &&
9288
"type metadata cannot contain an archetype");
@@ -96,7 +92,7 @@ DebugTypeInfo DebugTypeInfo::getGlobalMetadata(swift::Type Ty,
9692
DebugTypeInfo DebugTypeInfo::getTypeMetadata(swift::Type Ty,
9793
llvm::Type *StorageTy, Size size,
9894
Alignment align) {
99-
DebugTypeInfo DbgTy(Ty.getPointer(), StorageTy, align, true, true, false);
95+
DebugTypeInfo DbgTy(Ty.getPointer(), StorageTy, align, true, true);
10096
assert(StorageTy && "StorageType is a nullptr");
10197
assert(!DbgTy.isContextArchetype() &&
10298
"type metadata cannot contain an archetype");
@@ -121,7 +117,7 @@ DebugTypeInfo DebugTypeInfo::getGlobal(SILGlobalVariable *GV,
121117
Type = DeclType.getPointer();
122118
}
123119
auto &TI = IGM.getTypeInfoForUnlowered(Type);
124-
DebugTypeInfo DbgTy = getFromTypeInfo(Type, TI, IGM, false);
120+
DebugTypeInfo DbgTy = getFromTypeInfo(Type, TI, IGM);
125121
assert(FragmentStorageType && "FragmentStorageType is a nullptr");
126122
assert(!DbgTy.isContextArchetype() &&
127123
"type of global variable cannot be an archetype");
@@ -142,7 +138,7 @@ DebugTypeInfo::getGlobalFixedBuffer(SILGlobalVariable *GV,
142138
Type = DeclType.getPointer();
143139
}
144140
DebugTypeInfo DbgTy(Type, FragmentStorageType,
145-
Align, ::hasDefaultAlignment(Type), false, false, true);
141+
Align, ::hasDefaultAlignment(Type), false, true);
146142
assert(FragmentStorageType && "FragmentStorageType is a nullptr");
147143
assert(!DbgTy.isContextArchetype() &&
148144
"type of global variable cannot be an archetype");
@@ -153,7 +149,7 @@ DebugTypeInfo DebugTypeInfo::getObjCClass(ClassDecl *theClass,
153149
llvm::Type *FragmentStorageType,
154150
Size SizeInBytes, Alignment align) {
155151
DebugTypeInfo DbgTy(theClass->getInterfaceType().getPointer(),
156-
FragmentStorageType, align, true, false, false);
152+
FragmentStorageType, align, true, false);
157153
assert(FragmentStorageType && "FragmentStorageType is a nullptr");
158154
assert(!DbgTy.isContextArchetype() &&
159155
"type of objc class cannot be an archetype");
@@ -163,7 +159,7 @@ DebugTypeInfo DebugTypeInfo::getObjCClass(ClassDecl *theClass,
163159
DebugTypeInfo DebugTypeInfo::getErrorResult(swift::Type Ty,
164160
IRGenModule &IGM) {
165161
auto &TI = IGM.getTypeInfoForUnlowered(Ty);
166-
DebugTypeInfo DbgTy = getFromTypeInfo(Ty, TI, IGM, false);
162+
DebugTypeInfo DbgTy = getFromTypeInfo(Ty, TI, IGM);
167163
return DbgTy;
168164
}
169165

@@ -216,6 +212,5 @@ CompletedDebugTypeInfo::getFromTypeInfo(swift::Type Ty, const TypeInfo &Info, IR
216212
}
217213

218214
return CompletedDebugTypeInfo::get(
219-
DebugTypeInfo::getFromTypeInfo(Ty, Info, IGM, /*IsFragment*/ false),
220-
SizeInBits);
215+
DebugTypeInfo::getFromTypeInfo(Ty, Info, IGM), SizeInBits);
221216
}

lib/IRGen/DebugTypeInfo.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,19 @@ class DebugTypeInfo {
4848
Alignment Align;
4949
bool DefaultAlignment = true;
5050
bool IsMetadataType = false;
51-
bool SizeIsFragmentSize = false;
5251
bool IsFixedBuffer = false;
5352

5453
public:
5554
DebugTypeInfo() = default;
5655
DebugTypeInfo(swift::Type Ty, llvm::Type *StorageTy = nullptr,
5756
Alignment AlignInBytes = Alignment(1),
5857
bool HasDefaultAlignment = true, bool IsMetadataType = false,
59-
bool IsFragmentTypeInfo = false, bool IsFixedBuffer = false,
58+
bool IsFixedBuffer = false,
6059
std::optional<uint32_t> NumExtraInhabitants = {});
6160

6261
/// Create type for a local variable.
6362
static DebugTypeInfo getLocalVariable(VarDecl *Decl, swift::Type Ty,
64-
const TypeInfo &Info, IRGenModule &IGM,
65-
bool IsFragmentTypeInfo);
63+
const TypeInfo &Info, IRGenModule &IGM);
6664
/// Create type for global type metadata.
6765
static DebugTypeInfo getGlobalMetadata(swift::Type Ty, llvm::Type *StorageTy,
6866
Size size, Alignment align);
@@ -75,8 +73,7 @@ class DebugTypeInfo {
7573

7674
/// Create a standalone type from a TypeInfo object.
7775
static DebugTypeInfo getFromTypeInfo(swift::Type Ty, const TypeInfo &Info,
78-
IRGenModule &IGM,
79-
bool IsFragmentTypeInfo);
76+
IRGenModule &IGM);
8077
/// Global variables.
8178
static DebugTypeInfo getGlobal(SILGlobalVariable *GV,
8279
llvm::Type *StorageType, IRGenModule &IGM);
@@ -109,7 +106,6 @@ class DebugTypeInfo {
109106
bool isForwardDecl() const { return FragmentStorageType == nullptr; }
110107
bool isMetadataType() const { return IsMetadataType; }
111108
bool hasDefaultAlignment() const { return DefaultAlignment; }
112-
bool isSizeFragmentSize() const { return SizeIsFragmentSize; }
113109
bool isFixedBuffer() const { return IsFixedBuffer; }
114110
std::optional<uint32_t> getNumExtraInhabitants() const {
115111
return NumExtraInhabitants;
@@ -156,7 +152,7 @@ template <> struct DenseMapInfo<swift::irgen::DebugTypeInfo> {
156152
static swift::irgen::DebugTypeInfo getTombstoneKey() {
157153
return swift::irgen::DebugTypeInfo(
158154
llvm::DenseMapInfo<swift::TypeBase *>::getTombstoneKey(), nullptr,
159-
swift::irgen::Alignment(), false, false, false);
155+
swift::irgen::Alignment(), false, false);
160156
}
161157
static unsigned getHashValue(swift::irgen::DebugTypeInfo Val) {
162158
return DenseMapInfo<swift::CanType>::getHashValue(Val.getType());

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
11411141
memberTy,
11421142
IGM.getTypeInfoForUnlowered(
11431143
IGM.getSILTypes().getAbstractionPattern(VD), memberTy),
1144-
IGM, false);
1144+
IGM);
11451145
unsigned OffsetInBits = 0;
11461146
llvm::DIType *DITy = createMemberType(DbgTy, VD->getName().str(),
11471147
OffsetInBits, Scope, File, Flags);
@@ -1176,8 +1176,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
11761176
UnsubstitutedTy = Decl->mapTypeIntoContext(UnsubstitutedTy);
11771177

11781178
auto DbgTy = DebugTypeInfo::getFromTypeInfo(
1179-
UnsubstitutedTy, IGM.getTypeInfoForUnlowered(UnsubstitutedTy), IGM,
1180-
false);
1179+
UnsubstitutedTy, IGM.getTypeInfoForUnlowered(UnsubstitutedTy), IGM);
11811180
Mangle::ASTMangler Mangler;
11821181
std::string DeclTypeMangledName = Mangler.mangleTypeForDebugger(
11831182
UnsubstitutedTy->mapTypeOutOfContext(), {});
@@ -1195,8 +1194,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
11951194
auto SuperClassTy = ClassTy->getSuperclass();
11961195
if (SuperClassTy) {
11971196
auto SuperClassDbgTy = DebugTypeInfo::getFromTypeInfo(
1198-
SuperClassTy, IGM.getTypeInfoForUnlowered(SuperClassTy), IGM,
1199-
false);
1197+
SuperClassTy, IGM.getTypeInfoForUnlowered(SuperClassTy), IGM);
12001198

12011199
llvm::DIType *SuperClassDITy = getOrCreateType(SuperClassDbgTy);
12021200
assert(SuperClassDITy && "getOrCreateType should never return null!");
@@ -1376,7 +1374,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
13761374
// A variant case which carries a payload.
13771375
ArgTy = ElemDecl->getParentEnum()->mapTypeIntoContext(ArgTy);
13781376
ElemDbgTy = DebugTypeInfo::getFromTypeInfo(
1379-
ArgTy, IGM.getTypeInfoForUnlowered(ArgTy), IGM, false);
1377+
ArgTy, IGM.getTypeInfoForUnlowered(ArgTy), IGM);
13801378
unsigned Offset = 0;
13811379
auto MTy =
13821380
createMemberType(*ElemDbgTy, ElemDecl->getBaseIdentifier().str(),
@@ -1419,8 +1417,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
14191417
llvm::DIType *getOrCreateDesugaredType(Type Ty, DebugTypeInfo DbgTy) {
14201418
DebugTypeInfo BlandDbgTy(Ty, DbgTy.getFragmentStorageType(),
14211419
DbgTy.getAlignment(), DbgTy.hasDefaultAlignment(),
1422-
DbgTy.isMetadataType(), DbgTy.isSizeFragmentSize(),
1423-
DbgTy.isFixedBuffer());
1420+
DbgTy.isMetadataType(), DbgTy.isFixedBuffer());
14241421
return getOrCreateType(BlandDbgTy);
14251422
}
14261423

@@ -1450,7 +1447,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
14501447
// For full debug info don't generate just a forward declaration for
14511448
// the generic type parameters.
14521449
ParamDebugType = DebugTypeInfo::getFromTypeInfo(
1453-
Param, IGM.getTypeInfoForUnlowered(Param), IGM, false);
1450+
Param, IGM.getTypeInfoForUnlowered(Param), IGM);
14541451
else
14551452
ParamDebugType = DebugTypeInfo::getForwardDecl(Param);
14561453

@@ -1621,7 +1618,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
16211618
auto &elemTI = IGM.getTypeInfoForUnlowered(
16221619
AbstractionPattern(genericSig, ElemTy->getCanonicalType()), ElemTy);
16231620
auto DbgTy =
1624-
DebugTypeInfo::getFromTypeInfo(ElemTy, elemTI, IGM, false);
1621+
DebugTypeInfo::getFromTypeInfo(ElemTy, elemTI, IGM);
16251622
Elements.push_back(
16261623
createMemberType(DbgTy, "", OffsetInBits, Scope, MainFile, Flags));
16271624
}
@@ -1823,8 +1820,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
18231820
auto SuperClassTy = ClassTy->getSuperclass();
18241821
if (SuperClassTy) {
18251822
auto SuperClassDbgTy = DebugTypeInfo::getFromTypeInfo(
1826-
SuperClassTy, IGM.getTypeInfoForUnlowered(SuperClassTy), IGM,
1827-
false);
1823+
SuperClassTy, IGM.getTypeInfoForUnlowered(SuperClassTy), IGM);
18281824

18291825
llvm::DIType *SuperClassDITy = getOrCreateType(SuperClassDbgTy);
18301826
assert(SuperClassDITy && "getOrCreateType should never return null!");
@@ -1969,7 +1965,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
19691965
IGM.getLoweredType(ProtocolDecl->getInterfaceType()).getASTType();
19701966
auto PDbgTy = DebugTypeInfo::getFromTypeInfo(
19711967
ProtocolDecl->getInterfaceType(), IGM.getTypeInfoForLowered(PTy),
1972-
IGM, false);
1968+
IGM);
19731969
auto PDITy = getOrCreateType(PDbgTy);
19741970
Protocols.push_back(
19751971
DBuilder.createInheritance(FwdDecl.get(), PDITy, 0, 0, Flags));
@@ -2033,8 +2029,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
20332029
UnsubstitutedTy = Decl->mapTypeIntoContext(UnsubstitutedTy);
20342030

20352031
auto DbgTy = DebugTypeInfo::getFromTypeInfo(
2036-
UnsubstitutedTy, IGM.getTypeInfoForUnlowered(UnsubstitutedTy), IGM,
2037-
false);
2032+
UnsubstitutedTy, IGM.getTypeInfoForUnlowered(UnsubstitutedTy), IGM);
20382033
Mangle::ASTMangler Mangler;
20392034
std::string DeclTypeMangledName = Mangler.mangleTypeForDebugger(
20402035
UnsubstitutedTy->mapTypeOutOfContext(), {});
@@ -2061,7 +2056,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
20612056
auto *BuiltinVectorTy = BaseTy->castTo<BuiltinVectorType>();
20622057
auto ElemTy = BuiltinVectorTy->getElementType();
20632058
auto ElemDbgTy = DebugTypeInfo::getFromTypeInfo(
2064-
ElemTy, IGM.getTypeInfoForUnlowered(ElemTy), IGM, false);
2059+
ElemTy, IGM.getTypeInfoForUnlowered(ElemTy), IGM);
20652060
unsigned Count = BuiltinVectorTy->getNumElements();
20662061
auto Subscript = DBuilder.getOrCreateSubrange(0, Count ? Count : -1);
20672062
return DBuilder.createVectorType(SizeInBits, AlignInBits,
@@ -2096,8 +2091,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
20962091
DebugTypeInfo AliasedDbgTy(
20972092
AliasedTy, DbgTy.getFragmentStorageType(),
20982093
DbgTy.getAlignment(), DbgTy.hasDefaultAlignment(), false,
2099-
DbgTy.isSizeFragmentSize(), DbgTy.isFixedBuffer(),
2100-
DbgTy.getNumExtraInhabitants());
2094+
DbgTy.isFixedBuffer(), DbgTy.getNumExtraInhabitants());
21012095
return DBuilder.createTypedef(getOrCreateType(AliasedDbgTy), MangledName,
21022096
L.File, 0, Scope);
21032097
}
@@ -2216,7 +2210,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
22162210
return;
22172211
for (auto BuiltinType: IGM.getOrCreateSpecialStlibBuiltinTypes()) {
22182212
auto DbgTy = DebugTypeInfo::getFromTypeInfo(
2219-
BuiltinType, IGM.getTypeInfoForUnlowered(BuiltinType), IGM, false);
2213+
BuiltinType, IGM.getTypeInfoForUnlowered(BuiltinType), IGM);
22202214
DBuilder.retainType(getOrCreateType(DbgTy));
22212215
}
22222216
}
@@ -2861,7 +2855,7 @@ IRGenDebugInfoImpl::emitFunction(const SILDebugScope *DS, llvm::Function *Fn,
28612855

28622856
auto DTI = DebugTypeInfo::getFromTypeInfo(
28632857
errorResultTy,
2864-
IGM.getTypeInfo(SILTy), IGM, false);
2858+
IGM.getTypeInfo(SILTy), IGM);
28652859
Error = DBuilder.getOrCreateArray({getOrCreateType(DTI)}).get();
28662860
}
28672861

lib/IRGen/IRGenSIL.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5441,14 +5441,11 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) {
54415441
VarInfo->Name = getVarName(i, IsAnonymous);
54425442
DebugTypeInfo DbgTy;
54435443
SILType SILTy;
5444-
bool IsFragmentType = false;
54455444
if (auto MaybeSILTy = VarInfo->Type) {
54465445
// If there is auxiliary type info, use it
54475446
SILTy = *MaybeSILTy;
54485447
} else {
54495448
SILTy = SILVal->getType();
5450-
if (VarInfo->DIExpr)
5451-
IsFragmentType = VarInfo->DIExpr.hasFragment();
54525449
}
54535450

54545451
auto RealTy = SILTy.getASTType();
@@ -5473,11 +5470,10 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) {
54735470
// Figure out the debug variable type
54745471
if (VD) {
54755472
DbgTy = DebugTypeInfo::getLocalVariable(VD, RealTy, getTypeInfo(SILTy),
5476-
IGM, IsFragmentType);
5473+
IGM);
54775474
} else if (!SILTy.hasArchetype() && !VarInfo->Name.empty()) {
54785475
// Handle the cases that read from a SIL file
5479-
DbgTy = DebugTypeInfo::getFromTypeInfo(RealTy, getTypeInfo(SILTy), IGM,
5480-
IsFragmentType);
5476+
DbgTy = DebugTypeInfo::getFromTypeInfo(RealTy, getTypeInfo(SILTy), IGM);
54815477
} else
54825478
return;
54835479

@@ -5865,24 +5861,19 @@ void IRGenSILFunction::emitDebugInfoForAllocStack(AllocStackInst *i,
58655861
}
58665862

58675863
SILType SILTy;
5868-
bool IsFragmentType = false;
58695864
if (auto MaybeSILTy = VarInfo->Type) {
58705865
// If there is auxiliary type info, use it
58715866
SILTy = *MaybeSILTy;
58725867
} else {
58735868
SILTy = i->getType();
5874-
if (VarInfo->DIExpr)
5875-
IsFragmentType = VarInfo->DIExpr.hasFragment();
58765869
}
58775870
auto RealType = SILTy.getASTType();
58785871
DebugTypeInfo DbgTy;
58795872
if (Decl) {
5880-
DbgTy = DebugTypeInfo::getLocalVariable(Decl, RealType, type, IGM,
5881-
IsFragmentType);
5873+
DbgTy = DebugTypeInfo::getLocalVariable(Decl, RealType, type, IGM);
58825874
} else if (i->getFunction()->isBare() && !SILTy.hasArchetype() &&
58835875
!VarInfo->Name.empty()) {
5884-
DbgTy = DebugTypeInfo::getFromTypeInfo(RealType, getTypeInfo(SILTy), IGM,
5885-
IsFragmentType);
5876+
DbgTy = DebugTypeInfo::getFromTypeInfo(RealType, getTypeInfo(SILTy), IGM);
58865877
} else
58875878
return;
58885879

@@ -6139,7 +6130,7 @@ void IRGenSILFunction::visitAllocBoxInst(swift::AllocBoxInst *i) {
61396130
i->getBoxType(), IGM.getSILModule().Types, 0);
61406131
auto RealType = SILTy.getASTType();
61416132
auto DbgTy =
6142-
DebugTypeInfo::getLocalVariable(Decl, RealType, type, IGM, false);
6133+
DebugTypeInfo::getLocalVariable(Decl, RealType, type, IGM);
61436134

61446135
auto VarInfo = i->getVarInfo();
61456136
if (!VarInfo)

0 commit comments

Comments
 (0)