WEBVTT 99:59:59.999 --> 99:59:59.999 Okay, hi everybody, I am Scott. 99:59:59.999 --> 99:59:59.999 My mentor is Nico. I am from 99:59:59.999 --> 99:59:59.999 Perdue University. I am a PhD student. 99:59:59.999 --> 99:59:59.999 My talk is on MIR Optimizations. I work on 99:59:59.999 --> 99:59:59.999 the rust compiler. So this is the "get 99:59:59.999 --> 99:59:59.999 pumped up!" slide. I'm going to tell you 99:59:59.999 --> 99:59:59.999 these things and feel free to cheer 99:59:59.999 --> 99:59:59.999 whenever you're ready. Do you want faster 99:59:59.999 --> 99:59:59.999 programs? Yeah! 99:59:59.999 --> 99:59:59.999 [audience cheering "yeah!"] 99:59:59.999 --> 99:59:59.999 [audience laughs] 99:59:59.999 --> 99:59:59.999 Do you want longer battery life? 99:59:59.999 --> 99:59:59.999 [audience cheering "hell yeah!] 99:59:59.999 --> 99:59:59.999 Do you want more free memory? 99:59:59.999 --> 99:59:59.999 [audience cheering] 99:59:59.999 --> 99:59:59.999 We want all these things and how are we 99:59:59.999 --> 99:59:59.999 going to get them? We're going to get them 99:59:59.999 --> 99:59:59.999 through compiler optimization. 99:59:59.999 --> 99:59:59.999 [audience laughs] 99:59:59.999 --> 99:59:59.999 Okay, so I need to do some background 99:59:59.999 --> 99:59:59.999 before I jump into what I did this summer, but 99:59:59.999 --> 99:59:59.999 it's going to be pretty brief and high 99:59:59.999 --> 99:59:59.999 level, so I'll go fast just so we're all 99:59:59.999 --> 99:59:59.999 on the same page. We start from the Rust 99:59:59.999 --> 99:59:59.999 Source, which Cameron talked about Rust 99:59:59.999 --> 99:59:59.999 in his previous presentation. Basically 99:59:59.999 --> 99:59:59.999 it's a high level systems programming 99:59:59.999 --> 99:59:59.999 language. And the compiler doesn't just 99:59:59.999 --> 99:59:59.999 compile Rust line by line in the machine 99:59:59.999 --> 99:59:59.999 code, it goes through intermediate steps. 99:59:59.999 --> 99:59:59.999 It compiles the Rust Source to High Level 99:59:59.999 --> 99:59:59.999 Intermediate Representation to LLVM 99:59:59.999 --> 99:59:59.999 Intermediate Remediation, and then to 99:59:59.999 --> 99:59:59.999 Machine Code. This is pretty much how most 99:59:59.999 --> 99:59:59.999 compilers work of high level (incoherent) 99:59:59.999 --> 99:59:59.999 languages. You don't want to go from 99:59:59.999 --> 99:59:59.999 Source to Machine Code in one step. 99:59:59.999 --> 99:59:59.999 What we do recently--actually today the 99:59:59.999 --> 99:59:59.999 Rust team flipped the switch and now MIR 99:59:59.999 --> 99:59:59.999 is part of the Rust Compiler. MIR stands 99:59:59.999 --> 99:59:59.999 for "Middle Intermediate Representation" 99:59:59.999 --> 99:59:59.999 and it's coincidentally the same name of a 99:59:59.999 --> 99:59:59.999 space ship...that's the space ship. 99:59:59.999 --> 99:59:59.999 So what did we do? There's now a tiny 99:59:59.999 --> 99:59:59.999 space ship in the compiler and it's 99:59:59.999 --> 99:59:59.999 between the High Level and LLVM IR. 99:59:59.999 --> 99:59:59.999 So, why would we do this? What's MIR 99:59:59.999 --> 99:59:59.999 good for? Basically, it's the simple core 99:59:59.999 --> 99:59:59.999 of Rust. It makes things explicit that 99:59:59.999 --> 99:59:59.999 were not explicit in Rust's code because 99:59:59.999 --> 99:59:59.999 you wouldn't want the [incoherent] to 99:59:59.999 --> 99:59:59.999 detect these things out, obviously. Types 99:59:59.999 --> 99:59:59.999 of variables should be elighted in certain