mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[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
e718ff5dc3
commit
6b675e5ab5
@ -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
Block a user