forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang][OpenMP] Fix behavior when -fopenmp is not present on command …
…line When -fopenmp is not present, or gets hidden with -fno-openmp, compiler shouldn't give up parsing the command line. This will allow HPC users to pass -fno-openmp as override flag for subset of their code which doesn't contain OpenMP code, without writing new command lines by removing -fopenmp-targets, -Xopenmp-target, -march, etc. Fixes: SWDEV-294358 and SWDEV-323292 Change-Id: I82288adef2327fa590fd16d822acbf8cc9a1b541 (cherry picked from commit b266d5c)
- Loading branch information
Showing
3 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// REQUIRES: clang-driver | ||
// REQUIRES: x86-registered-target | ||
// REQUIRES: amdgpu-registered-target | ||
|
||
// RUN: %clang -### -target x86_64-linux-gnu \ | ||
// RUN: --offload-arch=gfx906 \ | ||
// RUN: %s 2>&1 | FileCheck -check-prefix=OFFLOAD %s | ||
// OFFLOAD: warning: argument unused during compilation: '--offload-arch=gfx906' | ||
|
||
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp\ | ||
// RUN: --offload-arch=gfx906 \ | ||
// RUN: -fno-openmp \ | ||
// RUN: %s 2>&1 | FileCheck -check-prefix=OFFLOAD1 %s | ||
// OFFLOAD1: warning: argument unused during compilation: '--offload-arch=gfx906' | ||
|
||
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp\ | ||
// RUN: -fopenmp-targets=amdgcn-amd-amdhsa,amdgcn-amd-amdhsa \ | ||
// RUN: -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906 \ | ||
// RUN: -fno-openmp \ | ||
// RUN: %s 2>&1 | FileCheck -check-prefix=LEGACY %s | ||
// LEGACY: warning: '-fopenmp-targets' must be used in conjunction with a '-fopenmp' option compatible with offloading; e.g., '-fopenmp=libomp' or '-fopenmp=libiomp5' | ||
// LEGACY-NEXT: warning: argument unused during compilation: '-Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906' | ||
|
||
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp\ | ||
// RUN: --offload-arch=gfx906 \ | ||
// RUN: --offload-arch=gfx908 \ | ||
// RUN: -fno-openmp \ | ||
// RUN: %s 2>&1 | FileCheck -check-prefix=MOFFLOAD %s | ||
// MOFFLOAD: warning: argument unused during compilation: '--offload-arch=gfx906' | ||
// MOFFLOAD-NEXT: warning: argument unused during compilation: '--offload-arch=gfx908' | ||
|
||
// RUN: %clang -### -target x86_64-linux-gnu -fopenmp\ | ||
// RUN: -fopenmp-targets=amdgcn-amd-amdhsa,amdgcn-amd-amdhsa \ | ||
// RUN: -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906 \ | ||
// RUN: -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx908 \ | ||
// RUN: -fno-openmp \ | ||
// RUN: %s 2>&1 | FileCheck -check-prefix=MLEGACY %s | ||
// MLEGACY: warning: '-fopenmp-targets' must be used in conjunction with a '-fopenmp' option compatible with offloading; e.g., '-fopenmp=libomp' or '-fopenmp=libiomp5' | ||
// MLEGACY: warning: argument unused during compilation: '-Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906' | ||
// MLEGACY: warning: argument unused during compilation: '-Xopenmp-target=amdgcn-amd-amdhsa -march=gfx908' |