We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9dd8c14 commit fb19bddCopy full SHA for fb19bdd
llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
@@ -197,12 +197,10 @@ struct ModuleAnalysisInfo {
197
// Convert MBB's number to corresponding ID register.
198
Register getOrCreateMBBRegister(const MachineBasicBlock &MBB) {
199
auto Key = std::make_pair(MBB.getParent(), MBB.getNumber());
200
- auto It = BBNumToRegMap.find(Key);
201
- if (It != BBNumToRegMap.end())
202
- return It->second;
203
- Register NewReg = Register::index2VirtReg(getNextID());
204
- BBNumToRegMap[Key] = NewReg;
205
- return NewReg;
+ auto [It, Inserted] = BBNumToRegMap.try_emplace(Key);
+ if (Inserted)
+ It->second = Register::index2VirtReg(getNextID());
+ return It->second;
206
}
207
};
208
} // namespace SPIRV
0 commit comments