]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/mod.rs
retool MIR passes completely
[rust.git] / src / librustc / ty / mod.rs
index 5e5dbdf20c04c471d56b49c0baa1ce03303e2665..cf66c83800d367d908b4a57f7c8b0dcec065f42c 100644 (file)
@@ -2323,9 +2323,9 @@ pub fn item_name(self, id: DefId) -> ast::Name {
         }
     }
 
-    /// Given the did of an item, returns its MIR, borrowed immutably.
+    /// Given the did of an item, returns its (optimized) MIR, borrowed immutably.
     pub fn item_mir(self, did: DefId) -> Ref<'gcx, Mir<'gcx>> {
-        self.mir(did).borrow()
+        self.optimized_mir(did).borrow()
     }
 
     /// Return the possibly-auto-generated MIR of a (DefId, Subst) pair.
@@ -2333,8 +2333,16 @@ pub fn instance_mir(self, instance: ty::InstanceDef<'gcx>)
                         -> Ref<'gcx, Mir<'gcx>>
     {
         match instance {
-            ty::InstanceDef::Item(did) if true => self.item_mir(did),
-            _ => self.mir_shims(instance).borrow(),
+            ty::InstanceDef::Item(did) => {
+                self.item_mir(did)
+            }
+            ty::InstanceDef::Intrinsic(..) |
+            ty::InstanceDef::FnPtrShim(..) |
+            ty::InstanceDef::Virtual(..) |
+            ty::InstanceDef::ClosureOnceShim { .. } |
+            ty::InstanceDef::DropGlue(..) => {
+                self.mir_shims(instance).borrow()
+            }
         }
     }