summaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Action.cpp
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2023-01-10 16:47:50 -0600
committerJoseph Huber <jhuber6@vols.utk.edu>2023-01-11 10:31:47 -0600
commit0d9afee3d159f5b7cdac7637808f3e25ff16a536 (patch)
tree022bdaadfb0a33b2766ba44feb3d4ba7fdc942fe /clang/lib/Driver/Action.cpp
parenta17ab7aa3be0b2b2adf992e3754a58f17802491f (diff)
[OpenMP] Adjust phases for AMDGPU offloading for OpenMP in save-temps mode
Currently, the behaviour of `-save-temps` changes the generated output when offloading to AMDGPU. This is because we only have a single phase and it contains the `-disable-llvm-passes` flags which results in unoptimized bitcode. We need to make sure we generate another phase that produces both the optimized and unoptimized bitcode. There used to be a check that turned these phases into a no-op. But I believe it is more correct to not generate them this way in the first place. Doing this requires a bit of a hack, replacing an already generated phase action, but it should be fine. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D141440
Diffstat (limited to 'clang/lib/Driver/Action.cpp')
-rw-r--r--clang/lib/Driver/Action.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Driver/Action.cpp b/clang/lib/Driver/Action.cpp
index 2fc0b9df42a4..44b4715503f0 100644
--- a/clang/lib/Driver/Action.cpp
+++ b/clang/lib/Driver/Action.cpp
@@ -221,13 +221,17 @@ OffloadAction::OffloadAction(const HostDependence &HDep,
// Add device inputs and propagate info to the device actions. Do work only if
// we have dependencies.
- for (unsigned i = 0, e = DDeps.getActions().size(); i != e; ++i)
+ for (unsigned i = 0, e = DDeps.getActions().size(); i != e; ++i) {
if (auto *A = DDeps.getActions()[i]) {
getInputs().push_back(A);
A->propagateDeviceOffloadInfo(DDeps.getOffloadKinds()[i],
DDeps.getBoundArchs()[i],
DDeps.getToolChains()[i]);
+ // If this action is used to forward single dependency, set the toolchain.
+ if (DDeps.getActions().size() == 1)
+ OffloadingToolChain = DDeps.getToolChains()[i];
}
+ }
}
void OffloadAction::doOnHostDependence(const OffloadActionWorkTy &Work) const {