This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][libomp] Detect if test compiler has omp.h
ClosedPublic

Authored by jlpeyton on Aug 2 2022, 10:44 AM.

Details

Summary

omp50_taskdep_depobj.c relies on the test compiler's omp.h file.
If the test compiler does not have an omp.h file, then use the one
within the build tree.

Fixes: https://github.com/llvm/llvm-project/issues/56820

Diff Detail

Event Timeline

jlpeyton created this revision.Aug 2 2022, 10:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 10:45 AM
jlpeyton requested review of this revision.Aug 2 2022, 10:45 AM

Rather than disabling the test, did you consider adding an -I${CMAKE_CURRENT_BINARY_DIR}/runtime/src (where omp.h resides) to the clang test flags? Even if there is an omp.h already on the system, libomp's header should be used instead since it may contain new symbols not yet present in the system's omp.h. It might even be -isystem to treat it like a system header.

Rather than disabling the test, did you consider adding an -I${CMAKE_CURRENT_BINARY_DIR}/runtime/src (where omp.h resides) to the clang test flags? Even if there is an omp.h already on the system, libomp's header should be used instead since it may contain new symbols not yet present in the system's omp.h. It might even be -isystem to treat it like a system header.

The test doesn't become disabled. It uses the generated omp.h instead. This is the only test that attempts to use the system omp.h (or test compiler's omp.h). The original purpose was to test GCC compatibility of depobj which GCC defines differently than our omp.h.

mgorny accepted this revision.Aug 2 2022, 12:06 PM

Thanks. I can confirm that this fixes the immediate problem for me.

omp50_taskdep_depobj.c relies on the test compiler's omp.h file. If the test compiler does not have an omp.h file, then the one within the build tree.

You seem to missing a verb in the commit message.

This revision is now accepted and ready to land.Aug 2 2022, 12:06 PM
jlpeyton edited the summary of this revision. (Show Details)Aug 2 2022, 3:07 PM
This revision was automatically updated to reflect the committed changes.

The test doesn't become disabled. It uses the generated omp.h instead. This is the only test that attempts to use the system omp.h (or test compiler's omp.h). The original purpose was to test GCC compatibility of depobj which GCC defines differently than our omp.h.

Indeed I missed that %flags-use-compiler-omp-h is specifically to test not using libomp's own omp.h.