From 57ef29f2835eb594bc2ad4793df05188be4c2ef6 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Tue, 6 Sep 2022 12:51:43 -0500 Subject: [PATCH] [OpenMP] Remove use of removed '-f[no-]openmp-new-driver' flag The changes in D130020 removed all support for the old method of compiling OpenMP offloading programs. This means that `-fopenmp-new-driver` has no effect and `-fno-openmp-new-driver` does not work. This patch removes the use and documentation of this flag. Note that the `--offload-new-driver` flag still exists for using the new driver optionally with CUDA and HIP. Reviewed By: tra Differential Revision: https://reviews.llvm.org/D133367 --- clang/docs/ClangCommandLineReference.rst | 4 ---- clang/lib/Driver/Driver.cpp | 4 +--- clang/lib/Driver/ToolChains/Clang.cpp | 8 ++------ clang/test/Driver/amdgpu-openmp-toolchain.c | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst index 141c146..a7dc063 100644 --- a/clang/docs/ClangCommandLineReference.rst +++ b/clang/docs/ClangCommandLineReference.rst @@ -2181,10 +2181,6 @@ Enable all Clang extensions for OpenMP directives and clauses Set rpath on OpenMP executables -.. option:: -fopenmp-new-driver - -Use the new driver for OpenMP offloading. - .. option:: -fopenmp-offload-mandatory Do not create a host fallback if offloading to the device fails. diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 3743515..36fba5d 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3902,9 +3902,7 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args, OffloadingActionBuilder OffloadBuilder(C, Args, Inputs); bool UseNewOffloadingDriver = - (C.isOffloadingHostKind(Action::OFK_OpenMP) && - Args.hasFlag(options::OPT_fopenmp_new_driver, - options::OPT_no_offload_new_driver, true)) || + C.isOffloadingHostKind(Action::OFK_OpenMP) || Args.hasFlag(options::OPT_offload_new_driver, options::OPT_no_offload_new_driver, false); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 99a8642..d39f871 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4459,9 +4459,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, bool IsDeviceOffloadAction = !(JA.isDeviceOffloading(Action::OFK_None) || JA.isDeviceOffloading(Action::OFK_Host)); bool IsHostOffloadingAction = - (JA.isHostOffloading(Action::OFK_OpenMP) && - Args.hasFlag(options::OPT_fopenmp_new_driver, - options::OPT_no_offload_new_driver, true)) || + JA.isHostOffloading(Action::OFK_OpenMP) || (JA.isHostOffloading(C.getActiveOffloadKinds()) && Args.hasFlag(options::OPT_offload_new_driver, options::OPT_no_offload_new_driver, false)); @@ -4762,9 +4760,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (IsUsingLTO) { // Only AMDGPU supports device-side LTO. - if (IsDeviceOffloadAction && - !Args.hasFlag(options::OPT_fopenmp_new_driver, - options::OPT_no_offload_new_driver, true) && + if (IsDeviceOffloadAction && !JA.isHostOffloading(Action::OFK_OpenMP) && !Args.hasFlag(options::OPT_offload_new_driver, options::OPT_no_offload_new_driver, false) && !Triple.isAMDGPU()) { diff --git a/clang/test/Driver/amdgpu-openmp-toolchain.c b/clang/test/Driver/amdgpu-openmp-toolchain.c index 1551917..50ce8e5 100644 --- a/clang/test/Driver/amdgpu-openmp-toolchain.c +++ b/clang/test/Driver/amdgpu-openmp-toolchain.c @@ -49,5 +49,5 @@ // RUN: %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-EMIT-LLVM-IR // CHECK-EMIT-LLVM-IR: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-emit-llvm" -// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -lm --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode -fopenmp-new-driver %s 2>&1 | FileCheck %s --check-prefix=CHECK-LIB-DEVICE-NEW +// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -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: {{.*}}clang-linker-wrapper{{.*}}--bitcode-library=openmp-amdgcn-amd-amdhsa-gfx803={{.*}}ocml.bc"{{.*}}ockl.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" -- 2.7.4