Fix the move constructor of MMI to move MachineFunctions map
authorSridhar Gopinath <sridhar.g@utexas.edu>
Fri, 24 Jul 2020 17:44:48 +0000 (10:44 -0700)
committerJustin Bogner <mail@justinbogner.com>
Mon, 27 Jul 2020 21:10:05 +0000 (14:10 -0700)
The move constructor of MachineModuleInfo currently does not copy the
MachineFunctions map. This commit fixes this issue.

Patch by Sridhar Gopinath. Thanks!

Differential Revision: https://reviews.llvm.org/D84274

llvm/lib/CodeGen/MachineModuleInfo.cpp

index f866c7ca53c680bc42357b63148ecb08d6f026b8..be08f0ae311712d2eb7d0621022be0a0e11a53b3 100644 (file)
@@ -178,7 +178,8 @@ void MachineModuleInfo::finalize() {
 MachineModuleInfo::MachineModuleInfo(MachineModuleInfo &&MMI)
     : TM(std::move(MMI.TM)),
       Context(MMI.TM.getMCAsmInfo(), MMI.TM.getMCRegisterInfo(),
-              MMI.TM.getObjFileLowering(), nullptr, nullptr, false) {
+              MMI.TM.getObjFileLowering(), nullptr, nullptr, false),
+      MachineFunctions(std::move(MMI.MachineFunctions)) {
   ObjFileMMI = MMI.ObjFileMMI;
   CurCallSite = MMI.CurCallSite;
   UsesMSVCFloatingPoint = MMI.UsesMSVCFloatingPoint;