Skip to content

Commit e7dd12d

Browse files
committed
Comments
1 parent ffa2217 commit e7dd12d

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

clang/include/clang/Driver/Driver.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,6 @@ class Driver {
370370
/// stored in it, and will clean them up when torn down.
371371
mutable llvm::StringMap<std::unique_ptr<ToolChain>> ToolChains;
372372

373-
public:
374-
/// The associated offloading architectures with each toolchain.
375-
llvm::DenseMap<const ToolChain *, llvm::SmallVector<llvm::StringRef>>
376-
OffloadArchs;
377-
378373
private:
379374
/// TranslateInputArgs - Create a new derived argument list from the input
380375
/// arguments, after applying the standard argument translations.

clang/lib/Driver/Driver.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)