[llvm] af27138 - [TableGen] Use map::try_emplace to construction DAGInstruction in the Instructions map. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 9 16:33:13 PDT 2023
Author: Craig Topper
Date: 2023-04-09T16:32:54-07:00
New Revision: af27138315c2cef058c2ad8b4070d78d60b4fdd1
URL: https://github.com/llvm/llvm-project/commit/af27138315c2cef058c2ad8b4070d78d60b4fdd1
DIFF: https://github.com/llvm/llvm-project/commit/af27138315c2cef058c2ad8b4070d78d60b4fdd1.diff
LOG: [TableGen] Use map::try_emplace to construction DAGInstruction in the Instructions map. NFC
We add entries to the map in two places. One already used
std::piecewise_construct with map::emplace. The other was using
map::insert. Change both to map::try_emplace.
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 56a18bd412a0..4463fe5151e3 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -3938,9 +3938,8 @@ void CodeGenDAGPatterns::parseInstructionPattern(
// Create and insert the instruction.
// FIXME: InstImpResults should not be part of DAGInstruction.
Record *R = I.getRecord();
- DAGInsts.emplace(std::piecewise_construct, std::forward_as_tuple(R),
- std::forward_as_tuple(Results, Operands, InstImpResults,
- SrcPattern, ResultPattern));
+ DAGInsts.try_emplace(R, Results, Operands, InstImpResults, SrcPattern,
+ ResultPattern);
LLVM_DEBUG(I.dump());
}
@@ -3981,8 +3980,7 @@ void CodeGenDAGPatterns::ParseInstructions() {
// Create and insert the instruction.
std::vector<Record*> ImpResults;
- Instructions.insert(std::make_pair(Instr,
- DAGInstruction(Results, Operands, ImpResults)));
+ Instructions.try_emplace(Instr, Results, Operands, ImpResults);
continue; // no pattern.
}
More information about the llvm-commits
mailing list