summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-08-11 12:55:33 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-08-11 12:55:33 +0800
commit386cd7f8102239c8ed6822aa7b1c8225fafcdc88 (patch)
tree1bda13c299bd4dc2470d2c8074f62a23a19997b7
parent7d1865d3545ca9f0d7b819cd1280f468aa6a302d (diff)
downloadmrust-386cd7f8102239c8ed6822aa7b1c8225fafcdc88.tar.gz
Notes - New idea for a MIR optimisation
-rw-r--r--Notes/MIR-Optimisations.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/Notes/MIR-Optimisations.md b/Notes/MIR-Optimisations.md
index baa737eb..df7d8239 100644
--- a/Notes/MIR-Optimisations.md
+++ b/Notes/MIR-Optimisations.md
@@ -236,3 +236,20 @@ Overview
for invalidation.
- If no invalidation found, replace usage with inner of assignment and erase
assignment.
+
+
+Slice Transmute
+===============
+Purpose: Detect places where slices are createdby transmuting from a (usize,usize) and replace with
+dedicated MIR statement.
+
+Overview
+--------
+- Find transmute calls with a destination type of `&[T]`
+- Check the input type:
+ - `(usize,usize)` : good
+ - `struct Foo { usize, usize }` : good
+- Check if the input was a use/write once local
+- Locate assignment of input
+ - Check if it was a struct/tuple literal
+- Remove assignment, replace transmute with at `MAKEDST` op