From 7a758b499cd4b243d211ad16c758f1fd8795afc6 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 16 Jun 2019 15:31:01 +0800 Subject: Notes - Add idea for a new MIR optimisation --- Notes/MIR-Optimisations.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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. + -- cgit v1.2.3