Skip to content

Commit 768d98e

Browse files
committed
Add a TODO in destructor analysis
1 parent 15e5364 commit 768d98e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/SILOptimizer/Transforms/DeadObjectElimination.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ static bool isDestroyArray(SILInstruction *inst) {
127127
/// Analyze the destructor for the class of ARI to see if any instructions in it
128128
/// could have side effects on the program outside the destructor. If it does
129129
/// not, then we can eliminate the destructor.
130+
/// TODO: Most default destructors with non-trivial elements will have a
131+
/// destroy_addr of the non-trivial element in the destructor, this analysis
132+
/// will return as having side-effects in such cases, leading to conservative
133+
/// results. Check if we can do better here.
130134
static DestructorEffects doesDestructorHaveSideEffects(AllocRefInstBase *ARI) {
131135
SILFunction *Fn = getDestructor(ARI);
132136
// If we can't find a constructor then assume it has side effects.

0 commit comments

Comments
 (0)