[mips] Fix use after free and an unnecessary copy introduced in r268896.

llvm-svn: 268913
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index 1b61535..bff4688 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -1322,8 +1322,9 @@
     return Op;
   }
 
-  static std::unique_ptr<MipsOperand>
-  CreateRegPair(MipsOperand MOP, SMLoc S, SMLoc E, MipsAsmParser &Parser) {
+  static std::unique_ptr<MipsOperand> CreateRegPair(const MipsOperand &MOP,
+                                                    SMLoc S, SMLoc E,
+                                                    MipsAsmParser &Parser) {
     auto Op = make_unique<MipsOperand>(k_RegPair, Parser);
     Op->RegIdx.Index = MOP.RegIdx.Index;
     Op->StartLoc = S;
@@ -4691,7 +4692,7 @@
     return MatchOperand_ParseFail;
 
   SMLoc E = Parser.getTok().getLoc();
-  MipsOperand &Op = static_cast<MipsOperand &>(*Operands.back());
+  MipsOperand Op = static_cast<MipsOperand &>(*Operands.back());
 
   Operands.pop_back();
   Operands.push_back(MipsOperand::CreateRegPair(Op, S, E, *this));