[Clang] Fix the wrong features being derivec in the offload packager
authorJoseph Huber <jhuber6@vols.utk.edu>
Fri, 8 Jul 2022 19:59:10 +0000 (15:59 -0400)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 8 Jul 2022 21:26:20 +0000 (17:26 -0400)
commit24849c9eb504cad5b17f16ed23a88dab92882d5d
treeb6d047b6bbbc2703e5905a792e217440d2e07096
parentd36b96afb2245d791eaf9d9b1b1adfa52df1e498
[Clang] Fix the wrong features being derivec in the offload packager

The offload packager embeds the features in the offloading binary when
performing LTO. This had an incorrect interaction with the
`--cuda-feature` option because we weren't deriving the features from
the CUDA toolchain arguments when it was being specified. This patch
fixes this so the features are correctly overrideen when using this
argument.

However, this brings up a question of how best to handle conflicting
target features. The user could compile many libraries with different
features, in this case we do not know which one to pick. This was not
previously a problem when we simply passed the features in from the CUDA
installation at link-link because we just defaulted to whatever was
current on the system.

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D129393
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/openmp-offload-gpu-new.c