Skip to content
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

[test][clang][driver] Fix test that assumes libomp default #119319

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

rupprecht
Copy link
Collaborator

755519f added a test that uses -fopenmp. The default configuration of CLANG_DEFAULT_OPENMP_RUNTIME is libomp, which causes -fopenmp to act as -fopenmp=libomp. In turn, this passes -fopenmp to downstream compilations. However, for other values, e.g. libgomp, Clang does not know how to generate useful openmp code, so it avoids passing the -fopenmp along. Fix the test to explicitly pass -fopenmp=libomp to pass regardless of the configured CLANG_DEFAULT_OPENMP_RUNTIME value.

The default configuration of CLANG_DEFAULT_OPENMP_RUNTIME is libomp, which causes `-fopenmp` to act as `-fopenmp=libomp`. In turn, this passes `-fopenmp` to downstream compilations. However, for other values, e.g. `-fopenmp=libgomp`, Clang does not know how to generate useful openmp code, so it avoids passing the `-fopenmp` along. Fix the test to explicitly pass `-fopenmp=libomp` to pass regardless of the configured CLANG_DEFAULT_OPENMP_RUNTIME value.
@rupprecht rupprecht requested a review from pawosm-arm December 10, 2024 03:48
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Dec 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 10, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Jordan Rupprecht (rupprecht)

Changes

755519f added a test that uses -fopenmp. The default configuration of CLANG_DEFAULT_OPENMP_RUNTIME is libomp, which causes -fopenmp to act as -fopenmp=libomp. In turn, this passes -fopenmp to downstream compilations. However, for other values, e.g. libgomp, Clang does not know how to generate useful openmp code, so it avoids passing the -fopenmp along. Fix the test to explicitly pass -fopenmp=libomp to pass regardless of the configured CLANG_DEFAULT_OPENMP_RUNTIME value.


Full diff: https://github.com/llvm/llvm-project/pull/119319.diff

1 Files Affected:

  • (modified) clang/test/Driver/config-file.c (+2-2)
diff --git a/clang/test/Driver/config-file.c b/clang/test/Driver/config-file.c
index e9a8555bcc8e43..e84d6dfca373a6 100644
--- a/clang/test/Driver/config-file.c
+++ b/clang/test/Driver/config-file.c
@@ -85,9 +85,9 @@
 
 //--- The linker input flags should be moved to the end of input list and appear only when linking.
 // RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg %s -lmylib -Wl,foo.a -### 2>&1 | FileCheck %s -check-prefix CHECK-LINKING
-// RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -fopenmp %s -lmylib -Wl,foo.a -### 2>&1 | FileCheck %s -check-prefix CHECK-LINKING-LIBOMP-GOES-AFTER
+// RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -fopenmp=libomp %s -lmylib -Wl,foo.a -### 2>&1 | FileCheck %s -check-prefix CHECK-LINKING-LIBOMP-GOES-AFTER
 // RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NOLINKING
-// RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -fopenmp -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NOLINKING-OPENMP
+// RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -fopenmp=libomp -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NOLINKING-OPENMP
 // RUN: %clang --target=x86_64-pc-windows-msvc    --config %S/Inputs/config-l.cfg %s -lmylib -Wl,foo.lib -### 2>&1 | FileCheck %s -check-prefix CHECK-LINKING-MSVC
 // RUN: %clang --target=x86_64-pc-windows-msvc    --config %S/Inputs/config-l.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NOLINKING-MSVC
 // CHECK-LINKING: Configuration file: {{.*}}Inputs{{.}}config-l.cfg

@rupprecht rupprecht merged commit cfbf809 into llvm:main Dec 10, 2024
9 of 10 checks passed
Colibrow pushed a commit to Colibrow/llvm-project that referenced this pull request Dec 10, 2024
755519f added a test that uses
`-fopenmp`. The default configuration of CLANG_DEFAULT_OPENMP_RUNTIME is
libomp, which causes `-fopenmp` to act as `-fopenmp=libomp`. In turn,
this passes `-fopenmp` to downstream compilations. However, for other
values, e.g. `libgomp`, Clang does not know how to generate useful
openmp code, so it avoids passing the `-fopenmp` along. Fix the test to
explicitly pass `-fopenmp=libomp` to pass regardless of the configured
CLANG_DEFAULT_OPENMP_RUNTIME value.
Copy link
Contributor

@pawosm-arm pawosm-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for fixing it.

@pawosm-arm
Copy link
Contributor

BTW, the flang test likely requires the same modification, I'll look into it later today.

pawosm-arm added a commit to pawosm-arm/llvm-project that referenced this pull request Dec 10, 2024
This patch supplements the fix introduced by PR llvm#119319.
pawosm-arm added a commit that referenced this pull request Dec 10, 2024
This patch supplements the fix introduced by PR #119319.
broxigarchen pushed a commit to broxigarchen/llvm-project that referenced this pull request Dec 10, 2024
755519f added a test that uses
`-fopenmp`. The default configuration of CLANG_DEFAULT_OPENMP_RUNTIME is
libomp, which causes `-fopenmp` to act as `-fopenmp=libomp`. In turn,
this passes `-fopenmp` to downstream compilations. However, for other
values, e.g. `libgomp`, Clang does not know how to generate useful
openmp code, so it avoids passing the `-fopenmp` along. Fix the test to
explicitly pass `-fopenmp=libomp` to pass regardless of the configured
CLANG_DEFAULT_OPENMP_RUNTIME value.
broxigarchen pushed a commit to broxigarchen/llvm-project that referenced this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants