diff options
-rw-r--r-- | llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index 0a571bd8628..7365953c111 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -3572,21 +3572,22 @@ const DAGInstruction &CodeGenDAGPatterns::parseInstructionPattern( // Create and insert the instruction. // FIXME: InstImpResults should not be part of DAGInstruction. - TreePattern *InstPattern = I.get(); - DAGInstruction TheInst(std::move(I), Results, Operands, InstImpResults); - DAGInsts.emplace(InstPattern->getRecord(), std::move(TheInst)); + Record *R = I->getRecord(); + DAGInstruction &TheInst = + DAGInsts.emplace(std::piecewise_construct, std::forward_as_tuple(R), + std::forward_as_tuple(std::move(I), Results, Operands, + InstImpResults)).first->second; // Use a temporary tree pattern to infer all types and make sure that the // constructed result is correct. This depends on the instruction already // being inserted into the DAGInsts map. - TreePattern Temp(InstPattern->getRecord(), ResultPattern, false, *this); - Temp.InferAllTypes(&InstPattern->getNamedNodesMap()); + TreePattern Temp(TheInst.getPattern()->getRecord(), ResultPattern, false, + *this); + Temp.InferAllTypes(&TheInst.getPattern()->getNamedNodesMap()); - DAGInstruction &TheInsertedInst = - DAGInsts.find(InstPattern->getRecord())->second; - TheInsertedInst.setResultPattern(Temp.getOnlyTree()); + TheInst.setResultPattern(Temp.getOnlyTree()); - return TheInsertedInst; + return TheInst; } /// ParseInstructions - Parse all of the instructions, inlining and resolving |