summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-06-16 15:31:01 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-06-16 15:31:01 +0800
commit7a758b499cd4b243d211ad16c758f1fd8795afc6 (patch)
treeaabd12b728c55077805bbf3dfa6c43278d67d017
parente38afeeddcf58092f598aef3cd05690f824457aa (diff)
downloadmrust-7a758b499cd4b243d211ad16c758f1fd8795afc6.tar.gz
Notes - Add idea for a new MIR optimisation
-rw-r--r--Notes/MIR-Optimisations.md15
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.
+