Skip to content

Commit 46c025a

Browse files
committed
[definite-init] Remove dead code.
collectRetainCountInfo bails early if our memory instruction is a mark_uninitialized... but our instruction is always a mark_uninitialized... so this code is dead. The origin of this code is from the flattening of the control flow in DI that was necessary to be done to "extract" predictable mem opts from it. rdar://40332620
1 parent cb1b15e commit 46c025a

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

lib/SILOptimizer/Mandatory/DIMemoryUseCollectorOwnership.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -389,23 +389,6 @@ bool DIMemoryObjectInfo::isElementLetProperty(unsigned Element) const {
389389
return false;
390390
}
391391

392-
void DIMemoryObjectInfo::collectRetainCountInfo(
393-
DIElementUseInfo &OutVar) const {
394-
if (isa<MarkUninitializedInst>(MemoryInst))
395-
return;
396-
397-
// Collect information about the retain count result as well.
398-
for (auto *Op : MemoryInst->getUses()) {
399-
auto *User = Op->getUser();
400-
401-
// If this is a release or dealloc_stack, then remember it as such.
402-
if (isa<StrongReleaseInst>(User) || isa<DeallocStackInst>(User) ||
403-
isa<DeallocBoxInst>(User) || isa<DestroyValueInst>(User)) {
404-
OutVar.trackDestroy(User);
405-
}
406-
}
407-
}
408-
409392
//===----------------------------------------------------------------------===//
410393
// DIMemoryUse Implementation
411394
//===----------------------------------------------------------------------===//
@@ -535,7 +518,6 @@ class ElementUseCollector {
535518
"Should have been handled outside of here");
536519
// If this is a class pointer, we need to look through ref_element_addrs.
537520
collectClassSelfUses();
538-
TheMemory.collectRetainCountInfo(UseInfo);
539521
return;
540522
}
541523

@@ -544,8 +526,6 @@ class ElementUseCollector {
544526
} else {
545527
collectUses(TheMemory.getAddress(), 0);
546528
}
547-
548-
TheMemory.collectRetainCountInfo(UseInfo);
549529
}
550530

551531
void trackUse(DIMemoryUse Use) { UseInfo.trackUse(Use); }
@@ -1794,14 +1774,12 @@ void swift::ownership::collectDIElementUsesFrom(
17941774
assert(MemoryInfo.NumElements == 1 && "delegating inits only have 1 bit");
17951775
auto *MUI = cast<MarkUninitializedInst>(MemoryInfo.MemoryInst);
17961776
collectValueTypeDelegatingInitUses(MemoryInfo, UseInfo, MUI);
1797-
MemoryInfo.collectRetainCountInfo(UseInfo);
17981777
return;
17991778
}
18001779

18011780
if (shouldPerformClassInitSelf(MemoryInfo)) {
18021781
DelegatingClassInitElementUseCollector UseCollector(MemoryInfo, UseInfo);
18031782
UseCollector.collectClassInitSelfUses();
1804-
MemoryInfo.collectRetainCountInfo(UseInfo);
18051783
return;
18061784
}
18071785

lib/SILOptimizer/Mandatory/DIMemoryUseCollectorOwnership.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ class DIMemoryObjectInfo {
218218

219219
/// If the specified value is a 'let' property in an initializer, return true.
220220
bool isElementLetProperty(unsigned Element) const;
221-
222-
void collectRetainCountInfo(DIElementUseInfo &OutVar) const;
223221
};
224222

225223
enum DIUseKind {

0 commit comments

Comments
 (0)