@@ -984,8 +984,9 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
984
984
} else
985
985
TC = &getToolChain (C.getInputArgs (), TT);
986
986
C.addOffloadDeviceToolChain (TC, Action::OFK_OpenMP);
987
- if (DerivedArchs.contains (TT.getTriple ()))
988
- KnownArchs[TC] = DerivedArchs[TT.getTriple ()];
987
+ auto It = DerivedArchs.find (TT.getTriple ());
988
+ if (It != DerivedArchs.end ())
989
+ KnownArchs[TC] = It->second ;
989
990
}
990
991
}
991
992
} else if (C.getInputArgs ().hasArg (options::OPT_fopenmp_targets_EQ)) {
@@ -3749,11 +3750,10 @@ class OffloadingActionBuilder final {
3749
3750
void recordHostAction (Action *HostAction, const Arg *InputArg) {
3750
3751
assert (HostAction && " Invalid host action" );
3751
3752
assert (InputArg && " Invalid input argument" );
3752
- auto Loc = HostActionToInputArgMap.find (HostAction);
3753
- if (Loc == HostActionToInputArgMap.end ())
3754
- HostActionToInputArgMap[HostAction] = InputArg;
3755
- assert (HostActionToInputArgMap[HostAction] == InputArg &&
3753
+ auto Loc = HostActionToInputArgMap.try_emplace (HostAction, InputArg).first ;
3754
+ assert (Loc->second == InputArg &&
3756
3755
" host action mapped to multiple input arguments" );
3756
+ (void )Loc;
3757
3757
}
3758
3758
3759
3759
// / Generate an action that adds device dependences (if any) to a host action.
@@ -5581,8 +5581,9 @@ InputInfoList Driver::BuildJobsForActionNoCache(
5581
5581
std::pair<const Action *, std::string> ActionTC = {
5582
5582
OA->getHostDependence (),
5583
5583
GetTriplePlusArchString (TC, BoundArch, TargetDeviceOffloadKind)};
5584
- if (CachedResults.find (ActionTC) != CachedResults.end ()) {
5585
- InputInfoList Inputs = CachedResults[ActionTC];
5584
+ auto It = CachedResults.find (ActionTC);
5585
+ if (It != CachedResults.end ()) {
5586
+ InputInfoList Inputs = It->second ;
5586
5587
Inputs.append (OffloadDependencesInputInfo);
5587
5588
return Inputs;
5588
5589
}
0 commit comments