Skip to content

Commit 5a28a6d

Browse files
authored
[IRGen] Remove some commented out code and clean up (#66056)
1 parent ce951aa commit 5a28a6d

File tree

1 file changed

+17
-49
lines changed

1 file changed

+17
-49
lines changed

lib/IRGen/TypeLayout.cpp

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,26 +1009,6 @@ llvm::Constant *
10091009
ScalarTypeLayoutEntry::layoutString(IRGenModule &IGM,
10101010
GenericSignature genericSig) const {
10111011
return nullptr;
1012-
// if (_layoutString) {
1013-
// return *_layoutString;
1014-
// }
1015-
1016-
// LayoutStringBuilder B{};
1017-
1018-
// if (!refCountString(IGM, B, genericSig)) {
1019-
// return *(_layoutString = llvm::Optional<llvm::Constant *>(nullptr));
1020-
// }
1021-
1022-
// ConstantInitBuilder IB(IGM);
1023-
// auto SB = IB.beginStruct();
1024-
// SB.setPacked(true);
1025-
1026-
// B.result(IGM, SB);
1027-
1028-
// _layoutString = SB.finishAndCreateGlobal("", IGM.getPointerAlignment(),
1029-
// /*constant*/ true);
1030-
1031-
// return *_layoutString;
10321012
}
10331013

10341014
bool ScalarTypeLayoutEntry::refCountString(IRGenModule &IGM,
@@ -1505,35 +1485,25 @@ AlignedGroupEntry::layoutString(IRGenModule &IGM,
15051485

15061486
bool AlignedGroupEntry::refCountString(IRGenModule &IGM, LayoutStringBuilder &B,
15071487
GenericSignature genericSig) const {
1508-
if (isFixedSize(IGM)) {
1509-
uint64_t offset = 0;
1510-
for (auto *entry : entries) {
1511-
if (offset) {
1512-
uint64_t alignmentMask = entry->fixedAlignment(IGM)->getMaskValue();
1513-
uint64_t alignedOffset = offset + alignmentMask;
1514-
alignedOffset &= ~alignmentMask;
1515-
if (alignedOffset > offset) {
1516-
B.addSkip(alignedOffset - offset);
1517-
offset = alignedOffset;
1518-
}
1519-
}
1520-
if (!entry->refCountString(IGM, B, genericSig)) {
1521-
return false;
1488+
if (!isFixedSize(IGM)) {
1489+
return false;
1490+
}
1491+
1492+
uint64_t offset = 0;
1493+
for (auto *entry : entries) {
1494+
if (offset) {
1495+
uint64_t alignmentMask = entry->fixedAlignment(IGM)->getMaskValue();
1496+
uint64_t alignedOffset = offset + alignmentMask;
1497+
alignedOffset &= ~alignmentMask;
1498+
if (alignedOffset > offset) {
1499+
B.addSkip(alignedOffset - offset);
1500+
offset = alignedOffset;
15221501
}
1523-
offset += entry->fixedSize(IGM)->getValue();
15241502
}
1525-
} else {
1526-
return false;
1527-
// B.startDynamicAlignment();
1528-
// for (auto *entry : entries) {
1529-
// if (entry->isFixedSize(IGM)) {
1530-
// B.addAlignment(entry->fixedAlignment(IGM)->getValue());
1531-
// }
1532-
// if (!entry->refCountString(IGM, B, genericSig)) {
1533-
// return false;
1534-
// }
1535-
// }
1536-
// B.endDynamicAlignment();
1503+
if (!entry->refCountString(IGM, B, genericSig)) {
1504+
return false;
1505+
}
1506+
offset += entry->fixedSize(IGM)->getValue();
15371507
}
15381508

15391509
return true;
@@ -3462,8 +3432,6 @@ TypeInfoBasedTypeLayoutEntry::layoutString(IRGenModule &IGM,
34623432
bool TypeInfoBasedTypeLayoutEntry::refCountString(
34633433
IRGenModule &IGM, LayoutStringBuilder &B,
34643434
GenericSignature genericSig) const {
3465-
// auto *accessor = createMetatypeAccessorFunction(IGM, representative);
3466-
// B.addResilientRefCount(accessor);
34673435
return false;
34683436
}
34693437

0 commit comments

Comments
 (0)