[PATCH] D134189: [CUDA][HIP] Fix new driver crashing when using -save-temps in RDC-mode
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 19 10:43:24 PDT 2022
tra added inline comments.
================
Comment at: clang/lib/Driver/Driver.cpp:4391
DDep.add(*PackagerAction, *C.getSingleOffloadToolChain<Action::OFK_Host>(),
- nullptr, Action::OFK_None);
+ nullptr, C.getActiveOffloadKinds());
}
----------------
`getActiveOffloadKinds` returns a mask of offload kinds, yet we cast it to `OffloadKind` in `DeviceDependences::add` above. This mixing of OffloadKind and sets of them looks questionable to me.
If we are relying on passing sets of `OffloadKind`now, then we should make it clear in the code that it is the intent, including a more detailed description that `DeviceOffloadKinds` is a list of `OffloadKind` sets, so whoever iterates over elements does not attempt to compare its elements with `OffloadKind` values. I think it would be helpful to change `DeviceOffloadKinds` element type to a new class with a helper method `hasOffloadKind(OffloadKind)` to avoid accidental comparison of a mask with enum value.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134189/new/
https://reviews.llvm.org/D134189
More information about the cfe-commits
mailing list