Commit 313f0e2
committed
[CopyPropagation] Added lexical destroy folding.
The new utility folds patterns like
TOP:
// %borrowee is some owned value
%lifetime = begin_borrow %borrowee
BOTTOM:
// %copy is some transitive copy of %borrowee
apply %f(%copy)
end_borrow %lifetime
destroy_value %borrowee
into
TOP:
%move = move_value [lexical] %borrowee
%lifetime begin_borrow [lexical] %move
BOTTOM:
end_borrow %lifetime
apply %f(%move)
It is intended to be run after ShrinkBorrowScope moves the end_borrow up
to just before a relevant apply and after CanonicalizeOSSALifetime moves
destroy_value instructions up to just after their last guaranteed use,
at which point these patterns will exist.1 parent 5c1a172 commit 313f0e2
File tree
5 files changed
+1618
-2
lines changed- include/swift/SILOptimizer/Utils
- lib/SILOptimizer/Utils
- test
- SILGen
- SILOptimizer
5 files changed
+1618
-2
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
0 commit comments