Skip to content

Commit

Permalink
Revert "Add clang-linker-wrapper option to specify the lto optimizati…
Browse files Browse the repository at this point in the history
…on pipeline"

This reverts commit dff11dd.

Reason for revert: None done upstream 

Change-Id: I55394fe4de7be6c7a5b90e8edd118f7980989f3a
  • Loading branch information
arsenm authored and ronlieb committed Nov 1, 2024
1 parent 6b1e24a commit f5f8c05
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 108 deletions.
6 changes: 0 additions & 6 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1236,12 +1236,6 @@ def offload_host_device : Flag<["--"], "offload-host-device">,
Visibility<[ClangOption, FlangOption]>,
HelpText<"Compile for both the offloading host and device (default).">;

def offload_lto_opt_pipeline_EQ : Joined<["-"], "offload-lto-opt-pipeline=">,
Visibility<[ClangOption, FlangOption]>,
HelpText<"Optimization pipeline to use during offload linking. Defaults to"
" 'default<On>' where n is based on -O">;


def gpu_use_aux_triple_only : Flag<["--"], "gpu-use-aux-triple-only">,
InternalDriverOpt, HelpText<"Prepare '-aux-triple' only without populating "
"'-aux-target-cpu' and '-aux-target-feature'.">;
Expand Down
20 changes: 0 additions & 20 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9729,26 +9729,6 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.getLastArg(options::OPT_save_temps_EQ))
CmdArgs.push_back("--save-temps");

if (const Arg *A =
Args.getLastArg(options::OPT_offload_lto_opt_pipeline_EQ)) {
CmdArgs.push_back(
Args.MakeArgString(Twine("--lto-opt-pipeline=") + A->getValue()));
} else if (D.getOffloadLTOMode() == LTOK_Full ||
D.getOffloadLTOMode() == LTOK_Thin ||
D.getLTOMode() == LTOK_Full || D.getLTOMode() == LTOK_Thin) {
StringRef val;
// OffloadLTOMode takes precedence over LTOMode
if (D.getOffloadLTOMode() == LTOK_Full)
val = "lto";
else if (D.getOffloadLTOMode() == LTOK_Thin)
val = "thinlto";
else if (D.getLTOMode() == LTOK_Full)
val = "lto";
else
val = "thinlto";
CmdArgs.push_back(Args.MakeArgString("--lto-opt-pipeline=" + val));
}

// Construct the link job so we can wrap around it.
Linker->ConstructJob(C, JA, Output, Inputs, Args, LinkingOutput);
const auto &LinkCommand = C.getJobs().getJobs().back();
Expand Down
10 changes: 0 additions & 10 deletions clang/test/Driver/amdgpu-openmp-toolchain-new.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,3 @@

// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 --no-opaque-offload-linker -lm --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode %s 2>&1 | FileCheck %s --check-prefix=CHECK-LIB-DEVICE-NEW
// CHECK-LIB-DEVICE-NEW: {{.*}}"-target-cpu" "gfx803"{{.*}}ocml.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"

// RUN: CLANG_USE_LINKER_WRAPPER=1 %clang -### --target=x86_64-unknown-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-LTO-OPT-PL-00
// CHECK-LTO-OPT-PL-00-NOT: clang-linker-wrapper{{.*}} "--lto-opt-pipeline"

// RUN: CLANG_USE_LINKER_WRAPPER=1 %clang -### --target=x86_64-unknown-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -nogpulib -offload-lto-opt-pipeline=lto %s 2>&1 | FileCheck %s --check-prefix=CHECK-LTO-OPT-PL-01
// RUN: CLANG_USE_LINKER_WRAPPER=1 %clang -### --target=x86_64-unknown-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -nogpulib -flto %s 2>&1 | FileCheck %s --check-prefix=CHECK-LTO-OPT-PL-01
// CHECK-LTO-OPT-PL-01: clang-linker-wrapper{{.*}} "--lto-opt-pipeline=lto"

// RUN: CLANG_USE_LINKER_WRAPPER=1 %clang -### --target=x86_64-unknown-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -nogpulib "-offload-lto-opt-pipeline=default<O3>" %s 2>&1 | FileCheck %s --check-prefix=CHECK-LTO-OPT-PL-02
// CHECK-LTO-OPT-PL-02: clang-linker-wrapper{{.*}} "--lto-opt-pipeline=default<O3>"
43 changes: 0 additions & 43 deletions clang/test/Driver/linker-wrapper-lto-opt-pipeline.c

This file was deleted.

11 changes: 0 additions & 11 deletions clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,17 +570,6 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args) {

for (StringRef Arg : Args.getAllArgValues(OPT_linker_arg_EQ))
CmdArgs.append({"-Xlinker", Args.MakeArgString(Arg)});

StringRef ltoOptPipeline = Args.getLastArgValue(OPT_lto_opt_pipeline_EQ, "");
if (ltoOptPipeline == "lto" || ltoOptPipeline == "default") {
// for convenience, add "<On>"
ltoOptPipeline = Args.MakeArgString(ltoOptPipeline + "<" + OptLevel + ">");
}
if (ltoOptPipeline.size()) {
CmdArgs.append({"-Xlinker", Args.MakeArgString("--lto-newpm-passes=" +
ltoOptPipeline)});
}

for (StringRef Arg : Args.getAllArgValues(OPT_compiler_arg_EQ))
CmdArgs.push_back(Args.MakeArgString(Arg));

Expand Down
5 changes: 0 additions & 5 deletions clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ def override_image : Joined<["--"], "override-image=">,
Flags<[WrapperOnlyOption]>, MetaVarName<"<kind=file>">,
HelpText<"Uses the provided file as if it were the output of the device link step">;

def lto_opt_pipeline_EQ : Joined<["--"], "lto-opt-pipeline=">,
Flags<[WrapperOnlyOption]>,
HelpText<"Optimization pipeline to use during LTO. Defaults to 'default<On>'"
" where n is based on --opt-level">;

// Flags passed to the device linker.
def arch_EQ : Joined<["--"], "arch=">,
Flags<[DeviceOnlyOption, HelpHidden]>, MetaVarName<"<arch>">,
Expand Down
13 changes: 0 additions & 13 deletions flang/test/Driver/offload-lto-pipeline.f90

This file was deleted.

0 comments on commit f5f8c05

Please sign in to comment.