forked from OSchip/llvm-project
[TableGen] Reduce the number of map lookups in TypeSetByHwMode::getOrCreate. NFCI
hasMode was looking up the map once. Then we'd either call get which would look up again, or we'd insert into the map which requires walking the map to find the insertion point. I believe the hasMode was needed because get has a special case to look for DefaultMode if the mode being asked for doesn't exist. We don't want that here so we were using hasMode to make sure we wouldn't hit that case. Simplify to a regular operator[] access which will default construct a SetType if the lookup fails.
This commit is contained in:
parent
13015ebd6f
commit
07edd78993
|
@ -200,9 +200,7 @@ struct TypeSetByHwMode : public InfoByHwMode<MachineValueTypeSet> {
|
|||
TypeSetByHwMode(ArrayRef<ValueTypeByHwMode> VTList);
|
||||
|
||||
SetType &getOrCreate(unsigned Mode) {
|
||||
if (hasMode(Mode))
|
||||
return get(Mode);
|
||||
return Map.insert({Mode,SetType()}).first->second;
|
||||
return Map[Mode];
|
||||
}
|
||||
|
||||
bool isValueTypeByHwMode(bool AllowEmpty) const;
|
||||
|
|
Loading…
Reference in New Issue