-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang][HIP] Remove 'clangPostLink' from SDL handling #67366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-driver ChangesSummary: Full diff: https://github.com/llvm/llvm-project/pull/67366.diff 3 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 6041ef4aeb673ef..6a0d35d0bef4bfb 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2023,8 +2023,7 @@ void tools::addX86AlignBranchArgs(const Driver &D, const ArgList &Args,
bool tools::SDLSearch(const Driver &D, const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
SmallVector<std::string, 8> LibraryPaths, std::string Lib,
- StringRef Arch, StringRef Target, bool isBitCodeSDL,
- bool postClangLink) {
+ StringRef Arch, StringRef Target, bool isBitCodeSDL) {
SmallVector<std::string, 12> SDLs;
std::string LibDeviceLoc = "/libdevice";
@@ -2083,8 +2082,6 @@ bool tools::SDLSearch(const Driver &D, const llvm::opt::ArgList &DriverArgs,
for (auto SDL : SDLs) {
auto FullName = Twine(LPath + SDL).str();
if (llvm::sys::fs::exists(FullName)) {
- if (postClangLink)
- CC1Args.push_back("-mlink-builtin-bitcode");
CC1Args.push_back(DriverArgs.MakeArgString(FullName));
FoundSDL = true;
break;
@@ -2104,8 +2101,7 @@ bool tools::GetSDLFromOffloadArchive(
Compilation &C, const Driver &D, const Tool &T, const JobAction &JA,
const InputInfoList &Inputs, const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args, SmallVector<std::string, 8> LibraryPaths,
- StringRef Lib, StringRef Arch, StringRef Target, bool isBitCodeSDL,
- bool postClangLink) {
+ StringRef Lib, StringRef Arch, StringRef Target, bool isBitCodeSDL) {
// We don't support bitcode archive bundles for nvptx
if (isBitCodeSDL && Arch.contains("nvptx"))
@@ -2203,8 +2199,6 @@ bool tools::GetSDLFromOffloadArchive(
C.addCommand(std::make_unique<Command>(
JA, T, ResponseFileSupport::AtFileCurCP(), UBProgram, UBArgs, Inputs,
InputInfo(&JA, C.getArgs().MakeArgString(OutputLib))));
- if (postClangLink)
- CC1Args.push_back("-mlink-builtin-bitcode");
CC1Args.push_back(DriverArgs.MakeArgString(OutputLib));
@@ -2218,9 +2212,9 @@ void tools::AddStaticDeviceLibsLinking(Compilation &C, const Tool &T,
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
StringRef Arch, StringRef Target,
- bool isBitCodeSDL, bool postClangLink) {
+ bool isBitCodeSDL) {
AddStaticDeviceLibs(&C, &T, &JA, &Inputs, C.getDriver(), DriverArgs, CC1Args,
- Arch, Target, isBitCodeSDL, postClangLink);
+ Arch, Target, isBitCodeSDL);
}
// User defined Static Device Libraries(SDLs) can be passed to clang for
@@ -2252,7 +2246,7 @@ void tools::AddStaticDeviceLibs(Compilation *C, const Tool *T,
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
StringRef Arch, StringRef Target,
- bool isBitCodeSDL, bool postClangLink) {
+ bool isBitCodeSDL) {
SmallVector<std::string, 8> LibraryPaths;
// Add search directories from LIBRARY_PATH env variable
@@ -2308,10 +2302,10 @@ void tools::AddStaticDeviceLibs(Compilation *C, const Tool *T,
for (auto SDLName : SDLNames) {
// This is the only call to SDLSearch
if (!SDLSearch(D, DriverArgs, CC1Args, LibraryPaths, SDLName, Arch, Target,
- isBitCodeSDL, postClangLink)) {
+ isBitCodeSDL)) {
GetSDLFromOffloadArchive(*C, D, *T, *JA, *Inputs, DriverArgs, CC1Args,
LibraryPaths, SDLName, Arch, Target,
- isBitCodeSDL, postClangLink);
+ isBitCodeSDL);
}
}
}
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.h b/clang/lib/Driver/ToolChains/CommonArgs.h
index 7585d24c3c0eb63..096152bfbdcf68a 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.h
+++ b/clang/lib/Driver/ToolChains/CommonArgs.h
@@ -59,19 +59,17 @@ void AddStaticDeviceLibsLinking(Compilation &C, const Tool &T,
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CmdArgs,
StringRef Arch, StringRef Target,
- bool isBitCodeSDL, bool postClangLink);
+ bool isBitCodeSDL);
void AddStaticDeviceLibs(Compilation *C, const Tool *T, const JobAction *JA,
const InputInfoList *Inputs, const Driver &D,
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CmdArgs, StringRef Arch,
- StringRef Target, bool isBitCodeSDL,
- bool postClangLink);
+ StringRef Target, bool isBitCodeSDL);
bool SDLSearch(const Driver &D, const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CmdArgs,
SmallVector<std::string, 8> LibraryPaths, std::string Lib,
- StringRef Arch, StringRef Target, bool isBitCodeSDL,
- bool postClangLink);
+ StringRef Arch, StringRef Target, bool isBitCodeSDL);
bool GetSDLFromOffloadArchive(Compilation &C, const Driver &D, const Tool &T,
const JobAction &JA, const InputInfoList &Inputs,
@@ -79,7 +77,7 @@ bool GetSDLFromOffloadArchive(Compilation &C, const Driver &D, const Tool &T,
llvm::opt::ArgStringList &CC1Args,
SmallVector<std::string, 8> LibraryPaths,
StringRef Lib, StringRef Arch, StringRef Target,
- bool isBitCodeSDL, bool postClangLink);
+ bool isBitCodeSDL);
const char *SplitDebugName(const JobAction &JA, const llvm::opt::ArgList &Args,
const InputInfo &Input, const InputInfo &Output);
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index 7ff880270cab3f7..3fc5669c06c3994 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -91,9 +91,7 @@ void AMDGCN::Linker::constructLlvmLinkCommand(Compilation &C,
// for the extracted archive of bitcode to inputs.
auto TargetID = Args.getLastArgValue(options::OPT_mcpu_EQ);
AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LlvmLinkArgs, "amdgcn",
- TargetID,
- /*IsBitCodeSDL=*/true,
- /*PostClangLink=*/false);
+ TargetID, /*IsBitCodeSDL=*/true);
const char *LlvmLink =
Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
@@ -179,9 +177,7 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
// for the extracted archive of bitcode to inputs.
auto TargetID = Args.getLastArgValue(options::OPT_mcpu_EQ);
AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LldArgs, "amdgcn",
- TargetID,
- /*IsBitCodeSDL=*/true,
- /*PostClangLink=*/false);
+ TargetID, /*IsBitCodeSDL=*/true);
LldArgs.push_back("--no-whole-archive");
|
Long term I'd like to move HIP to the new driver so we can delete all of this SDL handling code. That would require someone guiding me through how to test the toolchain on Windows so I can make the linker wrapper work with the Windows linker. |
✅ With the latest revision this PR passed the C/C++ code formatter. |
Summary: This feature is not needed anymore and is replaced by different implementations. The code guarded by this flag also causes us to emit an invalid argument to `-mlink-builtin-bitcode` that will cause errors if ever actually executed. Remove this feature.
8076d61
to
19b73b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Summary: This feature is not needed anymore and is replaced by different implementations. The code guarded by this flag also causes us to emit an invalid argument to `-mlink-builtin-bitcode` that will cause errors if ever actually executed. Remove this feature.
Summary:
This feature is not needed anymore and is replaced by different
implementations. The code guarded by this flag also causes us to emit an
invalid argument to
-mlink-builtin-bitcode
that will cause errors ifever actually executed. Remove this feature.