1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

[Attributor][NFC] Do not create temporary maps during lookup

The AAMap.lookup() call created a temporary value if the key was not
present. Since the value was another map it was not free to create it.
Instead of a lookup we now use find and compare the result against the
end iterator explicitly. The result is the same but we never need to
create a temporary map.
This commit is contained in:
Johannes Doerfert 2020-04-15 02:14:56 -05:00
parent 7a4ea32a4b
commit 87507aa30d

View File

@ -1195,9 +1195,11 @@ private:
// Lookup the abstract attribute of type AAType. If found, return it after
// registering a dependence of QueryingAA on the one returned attribute.
const auto &KindToAbstractAttributeMap = AAMap.lookup(IRP);
auto KindToAbstractAttributeMapIt = AAMap.find(IRP);
if ( KindToAbstractAttributeMapIt == AAMap.end())
return nullptr;
if (AAType *AA = static_cast<AAType *>(
KindToAbstractAttributeMap.lookup(&AAType::ID))) {
KindToAbstractAttributeMapIt->second.lookup(&AAType::ID))) {
// Do not register a dependence on an attribute with an invalid state.
if (TrackDependence && AA->getState().isValidState())
recordDependence(*AA, const_cast<AbstractAttribute &>(*QueryingAA),