Skip to content

Conversation

@aengelke
Copy link
Contributor

@aengelke aengelke commented Dec 12, 2025

Build examples and example plug-ins by default when running tests. If
examples are unwanted, they can still be disabled completely using
LLVM_INCLUDE_EXAMPLES=OFF. Plugin tests depend on examples and it is
beneficial to test them by default. By default, Examples will still not
be included in the default target or be installed, this remains
controlled by LLVM_BUILD_EXAMPLES (which defaults to OFF).

The additional cost for building examples for tests is 17 compilation
units (12 C++, 5 C), which should be tolerable.

I don't know how broken the examples currently are in the various build
configurations, but if we find breakage, it would be good to fix it.

Created using spr 1.3.5-bogner
@aengelke aengelke changed the title [WIP] [LLVM][CMake] Always build examples for tests [LLVM][CMake] Build examples for llvm-test-depends Dec 12, 2025
@aengelke aengelke marked this pull request as ready for review December 12, 2025 13:02
@aengelke aengelke added the cmake Build system in general and CMake in particular label Dec 12, 2025
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

To check my understanding of what this is going to do, does this sound correct?

  • LLVM_INCLUDE_EXAMPLES=OFF: Examples not built (and targets not generated).
  • LLVM_INCLUDE_EXAMPLES=ON, LLVM_BUILD_EXAMPLES=OFF: Examples not built by default target, but built by check-llvm. Examples not installed.
  • LLVM_INCLUDE_EXAMPLES=ON, LLVM_BUILD_EXAMPLES=ON: Examples built by default target and installed by install taret.

@aengelke
Copy link
Contributor Author

aengelke commented Dec 12, 2025

Yes.

Edit: worth noting that check-llvm will not cause all examples to be built, only those that are used in tests.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

Okay, I think that sounds reasonable to me. It would be good to update llvm/docs/CMake.rst.

Created using spr 1.3.5-bogner
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM, but please wait for a second opinion.

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

Seems reasonable enough to me, especially given the relative compile time/test cost.

@aengelke aengelke merged commit c81d449 into main Dec 13, 2025
11 checks passed
@aengelke aengelke deleted the users/aengelke/spr/wip-llvmcmake-always-build-examples-for-tests branch December 13, 2025 08:05
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Dec 13, 2025
Build examples and example plug-ins by default when running tests. If
examples are unwanted, they can still be disabled completely using
LLVM_INCLUDE_EXAMPLES=OFF. Plugin tests depend on examples and it is
beneficial to test them by default. By default, Examples will still not
be included in the default target or be installed, this remains
controlled by LLVM_BUILD_EXAMPLES (which defaults to OFF).

The additional cost for building examples for tests is 17 compilation
units (12 C++, 5 C), which should be tolerable.

I don't know how broken the examples currently are in the various build
configurations, but if we find breakage, it would be good to fix it.

Pull Request: llvm/llvm-project#171998
huixie90 added a commit to huixie90/llvm-project that referenced this pull request Dec 13, 2025
review

benchmark

format

fix comma

fix comma

lwg4482

rebase error

[LLVM][CMake] Build examples for llvm-test-depends

Build examples and example plug-ins by default when running tests. If
examples are unwanted, they can still be disabled completely using
LLVM_INCLUDE_EXAMPLES=OFF. Plugin tests depend on examples and it is
beneficial to test them by default. By default, Examples will still not
be included in the default target or be installed, this remains
controlled by LLVM_BUILD_EXAMPLES (which defaults to OFF).

The additional cost for building examples for tests is 17 compilation
units (12 C++, 5 C), which should be tolerable.

I don't know how broken the examples currently are in the various build
configurations, but if we find breakage, it would be good to fix it.

Pull Request: llvm#171998

Update libcxx/include/__ranges/adjacent_view.h

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>

?
huixie90 added a commit to huixie90/llvm-project that referenced this pull request Dec 13, 2025
review

benchmark

format

fix comma

fix comma

lwg4482

rebase error

[LLVM][CMake] Build examples for llvm-test-depends

Build examples and example plug-ins by default when running tests. If
examples are unwanted, they can still be disabled completely using
LLVM_INCLUDE_EXAMPLES=OFF. Plugin tests depend on examples and it is
beneficial to test them by default. By default, Examples will still not
be included in the default target or be installed, this remains
controlled by LLVM_BUILD_EXAMPLES (which defaults to OFF).

The additional cost for building examples for tests is 17 compilation
units (12 C++, 5 C), which should be tolerable.

I don't know how broken the examples currently are in the various build
configurations, but if we find breakage, it would be good to fix it.

Pull Request: llvm#171998

Update libcxx/include/__ranges/adjacent_view.h

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>

?
huixie90 added a commit to huixie90/llvm-project that referenced this pull request Dec 13, 2025
[libc++] implement adjacent_view

ci

ci

ci

ci

Update libcxx/include/__ranges/zip_utils.h

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>

review

review

benchmark

format

fix comma

fix comma

lwg4482

rebase error

[LLVM][CMake] Build examples for llvm-test-depends

Build examples and example plug-ins by default when running tests. If
examples are unwanted, they can still be disabled completely using
LLVM_INCLUDE_EXAMPLES=OFF. Plugin tests depend on examples and it is
beneficial to test them by default. By default, Examples will still not
be included in the default target or be installed, this remains
controlled by LLVM_BUILD_EXAMPLES (which defaults to OFF).

The additional cost for building examples for tests is 17 compilation
units (12 C++, 5 C), which should be tolerable.

I don't know how broken the examples currently are in the various build
configurations, but if we find breakage, it would be good to fix it.

Pull Request: llvm#171998

Update libcxx/include/__ranges/adjacent_view.h

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>

?

undo rebase

ci
@aengelke
Copy link
Contributor Author

There's less breakage than expected. From the buildbot failures:

  • llvm-clang-ubuntu-x-aarch64-pauth: Kaleidoscope fails with an assertion failure, orcv2 tests look for the x86-64 target (which is not built). Not sure what's going on here, cc @lhames. Workaround: temporarily require x86-registered-target
  • clang-armv8-quick, clang-armv7-global-isel: orcv2-cbindings-lazy.test is unsupported on armv8l/s390x; supported targets should be listed explicitly.
  • sanitizer-aarch64-linux-bootstrap-hwasan: test/Examples/IRTransforms/SimplifyCFG/* Fix: mark as unsupported if plugins are unavailable
  • sanitizer-x86_64-linux-android, reverse-iteration seem spurious/unrelated to this patch.

I fixed these with #172140, as the changes seemed simple enough.

@aengelke
Copy link
Contributor Author

aengelke commented Dec 13, 2025

More failures, fixed with #172147:

  • clang-s390x-linux, clang-s390x-linux-lnt: test/Examples/OrcV2Examples/lljit-with-remote-debugging.test requires JITLink, fix by adding target=s390{{.*}} to unsupported.
  • clang-riscv-rva23-evl-vec-2stage, clang-riscv-rva20-2stage, clang-riscv-rva23-zvl512b-2stage, clang-riscv-rva23-zvl1024b-2stage: Kaleidoscope tests fail with errors like JIT session error: Symbols not found: [ __adddf3 ] (or __gedf2 etc.), fix by marking riscv as unsupported.
  • ppc64le-mlir-rhel-clang: timeout, unrelated
  • ppc64le-flang-rhel-clang: seems unrelated, Flang test failure
  • sanitizer-x86_64-linux-fast seems spurious, CodeGen/X86/basic-block-sections-clusters-bb-hash.ll failed.
  • clang-arm64-windows-msvc: libomp test failure seems unrelated.

@aengelke
Copy link
Contributor Author

aix-ppc64 is also broken, there's neither JIT nor plugin support. Excluded AIX in 249acb6.

@aengelke
Copy link
Contributor Author

Filed #172203 for AIX plugins.

  • clang-solaris11-sparcv9 has no JIT support, disabled ORC tests there with 66d92d4.

anonymouspc pushed a commit to anonymouspc/llvm that referenced this pull request Dec 15, 2025
Build examples and example plug-ins by default when running tests. If
examples are unwanted, they can still be disabled completely using
LLVM_INCLUDE_EXAMPLES=OFF. Plugin tests depend on examples and it is
beneficial to test them by default. By default, Examples will still not
be included in the default target or be installed, this remains
controlled by LLVM_BUILD_EXAMPLES (which defaults to OFF).

The additional cost for building examples for tests is 17 compilation
units (12 C++, 5 C), which should be tolerable.

I don't know how broken the examples currently are in the various build
configurations, but if we find breakage, it would be good to fix it.

Pull Request: llvm#171998
@mgorny
Copy link
Member

mgorny commented Dec 15, 2025

FAIL: LLVM :: Examples/OrcV2Examples/lljit-with-remote-debugging.test (32940 of 62631)
******************** TEST 'LLVM :: Examples/OrcV2Examples/lljit-with-remote-debugging.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 9
/var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm_build-abi_x86_32.x86/bin/LLJITWithRemoteDebugging /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1.ll 2>&1 | /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm_build-abi_x86_32.x86/bin/FileCheck --check-prefix=CHECK0 /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test
# executed command: /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm_build-abi_x86_32.x86/bin/LLJITWithRemoteDebugging /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1.ll
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm_build-abi_x86_32.x86/bin/FileCheck --check-prefix=CHECK0 /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test
# .---command stderr------------
# | /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test:13:11: error: CHECK0: expected string not found in input
# | # CHECK0: Running: main()
# |           ^
# | <stdin>:5:130: note: scanning from here
# | Parsing input IR code from: /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1.ll
# |                                                                                                                                  ^
# | <stdin>:6:5: note: possible intended match here
# | Initializing LLJIT for remote executor
# |     ^
# | 
# | Input file: <stdin>
# | Check file: /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: __jit_debug_descriptor.last_entry = 0x0000000000000000 
# |             2: /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm_build-abi_x86_32.x86/bin/LLJITWithRemoteDebugging: Cannot enable LLJIT debugger support: Debugger support requires JITLink 
# |             3: Found out-of-process executor: /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm_build-abi_x86_32.x86/bin/llvm-jitlink-executor 
# |             4: Launched executor in subprocess: 44610 
# |             5: Parsing input IR code from: /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm/test/Examples/OrcV2Examples/Inputs/argc_sub1.ll 
# | check:13'0                                                                                                                                      X error: no match found
# |             6: Initializing LLJIT for remote executor 
# | check:13'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:13'1         ?                                   possible intended match
# |             7: __jit_debug_descriptor.last_entry = 0x0000000000000000 
# | check:13'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************

@aengelke
Copy link
Contributor Author

@mgorny Thanks for reporting. What architecture is this? Is this x32? Or is there anything else unusual about the build config? (Full target triple would be good to mark the test as unsupported.)

@weliveindetail
Copy link
Member

FYI: I never tested the ELFDebugObject JITLink plugin for 32bit targets. You can mark it unsupported.

@mgorny
Copy link
Member

mgorny commented Dec 15, 2025

32-bit multilib on amd64, i.e. i686-pc-linux-gnu.

@mgorny
Copy link
Member

mgorny commented Dec 15, 2025

FYI: I never tested the ELFDebugObject JITLink plugin for 32bit targets. You can mark it unsupported.

Sorry, do you mean the test or some larger piece of code?

@weliveindetail
Copy link
Member

Sorry, do you mean the test or some larger piece of code?

@mgorny This is unrelated from the PR. Let me ping you in a review that is in flight.

@mgorny
Copy link
Member

mgorny commented Dec 15, 2025

BTW this is weird:

# |             2: /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm_build-abi_x86_32.x86/bin/LLJITWithRemoteDebugging: Cannot enable LLJIT debugger support: Debugger support requires JITLink 

but it definitely does build /var/tmp/portage/llvm-core/llvm-22.0.0.9999/work/llvm_build-abi_x86_32.x86/lib/libLLVMJITLink.a.

mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Dec 19, 2025
Build examples and example plug-ins by default when running tests. If
examples are unwanted, they can still be disabled completely using
LLVM_INCLUDE_EXAMPLES=OFF. Plugin tests depend on examples and it is
beneficial to test them by default. By default, Examples will still not
be included in the default target or be installed, this remains
controlled by LLVM_BUILD_EXAMPLES (which defaults to OFF).

The additional cost for building examples for tests is 17 compilation
units (12 C++, 5 C), which should be tolerable.

I don't know how broken the examples currently are in the various build
configurations, but if we find breakage, it would be good to fix it.

Pull Request: llvm#171998
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Dec 20, 2025
Build examples and example plug-ins by default when running tests. If
examples are unwanted, they can still be disabled completely using
LLVM_INCLUDE_EXAMPLES=OFF. Plugin tests depend on examples and it is
beneficial to test them by default. By default, Examples will still not
be included in the default target or be installed, this remains
controlled by LLVM_BUILD_EXAMPLES (which defaults to OFF).

The additional cost for building examples for tests is 17 compilation
units (12 C++, 5 C), which should be tolerable.

I don't know how broken the examples currently are in the various build
configurations, but if we find breakage, it would be good to fix it.

Pull Request: llvm#171998
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake Build system in general and CMake in particular

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants