[CodeGen] Avoid repeated hash lookups (NFC) (#130543)

This commit is contained in:
Kazu Hirata 2025-03-09 23:15:32 -07:00 committed by GitHub
parent 5addbf0c60
commit b2b267ea7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4672,8 +4672,8 @@ class TypePromotionHelper {
static void addPromotedInst(InstrToOrigTy &PromotedInsts,
Instruction *ExtOpnd, bool IsSExt) {
ExtType ExtTy = IsSExt ? SignExtension : ZeroExtension;
InstrToOrigTy::iterator It = PromotedInsts.find(ExtOpnd);
if (It != PromotedInsts.end()) {
auto [It, Inserted] = PromotedInsts.try_emplace(ExtOpnd);
if (!Inserted) {
// If the new extension is same as original, the information in
// PromotedInsts[ExtOpnd] is still correct.
if (It->second.getInt() == ExtTy)
@ -4684,7 +4684,7 @@ class TypePromotionHelper {
// BothExtension.
ExtTy = BothExtension;
}
PromotedInsts[ExtOpnd] = TypeIsSExt(ExtOpnd->getType(), ExtTy);
It->second = TypeIsSExt(ExtOpnd->getType(), ExtTy);
}
/// Utility function to query the original type of instruction \p Opnd