Clear virtual registers after they are no longer referenced.
[oota-llvm.git] / lib / CodeGen / RegAllocGreedy.cpp
index 61e5e823dfd9ab1f97fda0a49bc19c038953f921..1d089ae253f8ead7b1f9051916fa54dbcfa757d0 100644 (file)
@@ -1698,7 +1698,10 @@ bool RAGreedy::runOnMachineFunction(MachineFunction &mf) {
     DebugVars->emitDebugValues(VRM);
   }
 
-  // The pass output is in VirtRegMap. Release all the transient data.
+  // All machine operands and other references to virtual registers have been
+  // replaced. Remove the virtual registers and release all the transient data.
+  VRM->clearAllVirt();
+  MRI->clearVirtRegs();
   releaseMemory();
 
   return true;