GlobalISel: clear vreg mapping after translating each function

Otherwise we only materialize (shared) constants in the first function they
appear in. This doesn't go well.

llvm-svn: 278351
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 0f06b54..5e07723 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -311,7 +311,9 @@
 }
 
 
-void IRTranslator::finalize() {
+void IRTranslator::finalizeFunction() {
+  finishPendingPhis();
+
   // Release the memory used by the different maps we
   // needed during the translation.
   ValToVReg.clear();
@@ -362,7 +364,7 @@
     }
   }
 
-  finishPendingPhis();
+  finalizeFunction();
 
   // Now that the MachineFrameInfo has been configured, no further changes to
   // the reserved registers are possible.