@@ -1040,7 +1040,7 @@ inferOffloadToolchains(Compilation &C, Action::OffloadKind Kind) {
10401040 Triples.insert (Triple);
10411041 }
10421042
1043- // These languages default to this if nothing is provided .
1043+ // Infer the default target triple if no specific architectures are given .
10441044 if (Archs.empty () && Kind == Action::OFK_HIP)
10451045 Triples.insert (" amdgcn-amd-amdhsa" );
10461046 else if (Archs.empty () && Kind == Action::OFK_Cuda)
@@ -1183,7 +1183,6 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
11831183 }
11841184
11851185 C.addOffloadDeviceToolChain (&TC, Kind);
1186- OffloadArchs[&TC] = getOffloadArchs (C, C.getArgs (), Kind, TC);
11871186 }
11881187 }
11891188}
@@ -3456,11 +3455,11 @@ class OffloadingActionBuilder final {
34563455
34573456 std::set<StringRef> GpuArchs;
34583457 for (Action::OffloadKind Kind : {Action::OFK_Cuda, Action::OFK_HIP}) {
3459- auto TCRange = C.getOffloadToolChains (Kind);
3460- for (auto &I : llvm::make_range (TCRange)) {
3458+ for (auto &I : llvm::make_range (C.getOffloadToolChains (Kind))) {
34613459 ToolChains.push_back (I.second );
34623460
3463- for (auto Arch : C.getDriver ().OffloadArchs .lookup (I.second ))
3461+ for (auto Arch :
3462+ C.getDriver ().getOffloadArchs (C, C.getArgs (), Kind, *I.second ))
34643463 GpuArchs.insert (Arch);
34653464 }
34663465 }
@@ -4846,7 +4845,7 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
48464845 // Get the product of all bound architectures and toolchains.
48474846 SmallVector<std::pair<const ToolChain *, StringRef>> TCAndArchs;
48484847 for (const ToolChain *TC : ToolChains) {
4849- for (StringRef Arch : OffloadArchs. lookup ( TC)) {
4848+ for (StringRef Arch : getOffloadArchs (C, C. getArgs (), Kind, * TC)) {
48504849 TCAndArchs.push_back (std::make_pair (TC, Arch));
48514850 DeviceActions.push_back (
48524851 C.MakeAction <InputAction>(*InputArg, InputType, CUID));
0 commit comments