[Driver] BuildOffloadingActions: Actually stabilize iteration order
In
```
/tmp/StaticDebug/bin/clang -ccc-print-phases -lsomelib -fopenmp=libomp --target=powerpc64-ibm-linux-gnu -fopenmp-targets=x86_64-pc-linux-gnu,powerpc64-ibm-linux-gnu clang/test/Driver/openmp-offload.c clang/test/Driver/openmp-offload.c
```
Both ToolChains have one single empty arch. llvm::sort in
LLVM_ENABLE_EXPENSIVE_CHECKS=on builds could swap the two entries.
Fixes: 255986e27f
This commit is contained in:
@@ -4597,10 +4597,13 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
|
||||
|
||||
// Get the product of all bound architectures and toolchains.
|
||||
SmallVector<std::pair<const ToolChain *, StringRef>> TCAndArchs;
|
||||
for (const ToolChain *TC : ToolChains)
|
||||
for (StringRef Arch : getOffloadArchs(C, Args, Kind, TC))
|
||||
for (const ToolChain *TC : ToolChains) {
|
||||
llvm::DenseSet<StringRef> Arches = getOffloadArchs(C, Args, Kind, TC);
|
||||
SmallVector<StringRef, 0> Sorted(Arches.begin(), Arches.end());
|
||||
llvm::sort(Sorted);
|
||||
for (StringRef Arch : Sorted)
|
||||
TCAndArchs.push_back(std::make_pair(TC, Arch));
|
||||
llvm::sort(TCAndArchs, llvm::less_second());
|
||||
}
|
||||
|
||||
for (unsigned I = 0, E = TCAndArchs.size(); I != E; ++I)
|
||||
DeviceActions.push_back(C.MakeAction<InputAction>(*InputArg, InputType));
|
||||
|
||||
Reference in New Issue
Block a user