diff options
-rw-r--r-- | Notes/MIR-Optimisations.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Notes/MIR-Optimisations.md b/Notes/MIR-Optimisations.md index 57f29c88..1f18e2a3 100644 --- a/Notes/MIR-Optimisations.md +++ b/Notes/MIR-Optimisations.md @@ -186,3 +186,18 @@ CFG Simplification ================== Purpose: Remove gotos to blocks that only have a single use + +Borrow Elimination +================== +Purpose: Remove borrows generated by method calls that have been inlined + +Overview +-------- +- Detect potential replacements: + - Find borrows of locals + - If destination of borrow is used directly (not via a deref), skip + - If the destination is re-assigned, skip + - Note, this should be able to tell if the re-assignment would be able to + invalidate the previous statements +- Replace all dereference usages of the destination with the original. + |