Skip to content

Commit d80e281

Browse files
committed
Add a comment to SemanticARC.
To explain something subtle: copying a loaded value is only required because assignment may cause the in-memory value to be released.
1 parent 9ffb35c commit d80e281

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/SILOptimizer/Mandatory/SemanticARCOpts.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,9 @@ bool SemanticARCOptVisitor::visitLoadInst(LoadInst *li) {
751751
if (!isDeadLiveRange(li, destroyValues))
752752
return false;
753753

754-
// Then check if our address is ever written to. If it is, then we
755-
// can not use the load_borrow.
754+
// Then check if our address is ever written to. If it is, then we cannot use
755+
// the load_borrow because the stored value may be released during the loaded
756+
// value's live range.
756757
if (isWrittenTo(li))
757758
return false;
758759

0 commit comments

Comments
 (0)