@@ -984,8 +984,9 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
984984 } else
985985 TC = &getToolChain (C.getInputArgs (), TT);
986986 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 ;
989990 }
990991 }
991992 } else if (C.getInputArgs ().hasArg (options::OPT_fopenmp_targets_EQ)) {
@@ -3749,11 +3750,10 @@ class OffloadingActionBuilder final {
37493750 void recordHostAction (Action *HostAction, const Arg *InputArg) {
37503751 assert (HostAction && " Invalid host action" );
37513752 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 &&
37563755 " host action mapped to multiple input arguments" );
3756+ (void )Loc;
37573757 }
37583758
37593759 // / Generate an action that adds device dependences (if any) to a host action.
@@ -5581,8 +5581,9 @@ InputInfoList Driver::BuildJobsForActionNoCache(
55815581 std::pair<const Action *, std::string> ActionTC = {
55825582 OA->getHostDependence (),
55835583 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 ;
55865587 Inputs.append (OffloadDependencesInputInfo);
55875588 return Inputs;
55885589 }
0 commit comments