Commit Graph

1214 Commits

Author SHA1 Message Date
Michal Gorny
0b373e161f [CMake] Allow for Solaris ld -V output on stdout
In recent versions of Solaris 11.4 (previously 12), ld -V output went to
stdout instead of stderr. Since AddLLVM.cmake only expects it on stderr,
Solaris ld wasn't properly detected and options not understood by it are
passed during the build.

The following patch fixes this, allowing for both variants.

Tested on i386-pc-solaris2.11.4 (on top of D35755 which is needed for
proper Solaris support).

Patch by Rainer Orth.

Differential Revision: https://reviews.llvm.org/D39601

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17 17:12:14 +00:00
Daniel Sanders
64b77007a6 [globalisel][tablegen] Generate rule coverage and use it to identify untested rules
Summary:
This patch adds a LLVM_ENABLE_GISEL_COV which, like LLVM_ENABLE_DAGISEL_COV,
causes TableGen to instrument the generated table to collect rule coverage
information. However, LLVM_ENABLE_GISEL_COV goes a bit further than
LLVM_ENABLE_DAGISEL_COV. The information is written to files
(${CMAKE_BINARY_DIR}/gisel-coverage-* by default). These files can then be
concatenated into ${LLVM_GISEL_COV_PREFIX}-all after which TableGen will
read this information and use it to emit warnings about untested rules.

This technique could also be used by SelectionDAG and can be further
extended to detect hot rules and give them priority over colder rules.

Usage:
* Enable LLVM_ENABLE_GISEL_COV in CMake
* Build the compiler and run some tests
* cat gisel-coverage-[0-9]* > gisel-coverage-all
* Delete lib/Target/*/*GenGlobalISel.inc*
* Build the compiler

Known issues:
* ${LLVM_GISEL_COV_PREFIX}-all must be generated as a manual
  step due to a lack of a portable 'cat' command. It should be the
  concatenation of all ${LLVM_GISEL_COV_PREFIX}-[0-9]* files.
* There's no mechanism to discard coverage information when the ruleset
  changes

Depends on D39742

Reviewers: ab, qcolombet, t.p.northover, aditya_nandakumar, rovka

Reviewed By: rovka

Subscribers: vsk, arsenm, nhaehnle, mgorny, kristof.beyls, javed.absar, igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D39747

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16 00:46:35 +00:00
Hans Wennborg
e144f87e90 CMake: Turn LLVM_ENABLE_LIBXML2 into a tri-state option
In addition to the current ON and OFF options, this adds the FORCE_ON
option, which causes a configuration error if libxml2 cannot be used.

Differential revision: https://reviews.llvm.org/D40050

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318209 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14 22:32:49 +00:00
Greg Bedwell
bf3b5163ff Move the setting of LLVM_BUILD_MODE to a macro so that we can re-use it in compiler-rt
Differential Revision: https://reviews.llvm.org/D38470

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318034 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13 12:40:05 +00:00
Zachary Turner
c54ecd0482 Add a Cross-compilation toolchain file for MSVC.
With this patch, you can now cross-compile for Windows
on non-Windows hosts.

Differential Revision: https://reviews.llvm.org/D39814

This allows cross-compiling for windows on other platforms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317830 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09 20:38:16 +00:00
Petr Hosek
a162211813 [CMake] Passthrough CMAKE_SYSROOT to external projects
Differential Revision: https://reviews.llvm.org/D39029

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317744 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09 00:21:29 +00:00
Vedant Kumar
bac49214a2 [cmake] Allow LLVM_BUILD_INSTRUMENTED to be set to IR or Frontend
- This deprecates LLVM_ENABLE_IR_PGO but keeps it around for now.
- Errors out when LLVM_BUILD_INSTRUMENTED and LLVM_BUILD_INSTRUMENTED_COVERAGE
  are both set.

Motivated by bogner's post-commit review of r313770.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317725 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08 21:26:40 +00:00
Jonas Hahnfeld
d44ed288f9 [CMake] Remove target to build native tablegen
This was once needed so that multiple tablegen binaries don't compile
the library concurrently. However, this isn't needed anymore since
adding USES_TERMINAL to the custom_command.
This is supported by the fact that the target was only building
LLVMSupport since some cleanups a year ago. If this dependency had
really been needed, we would have seen complaints.

Differential Revision: https://reviews.llvm.org/D39299

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317695 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08 14:31:54 +00:00
Jonas Hahnfeld
41dfa19981 [CMake] Add custom target to create build directory
CMake does a poor job in tracking dependencies on files and directories
directly. Create custom target similar to the configuration step.
On my system, this avoids the reconfiguration on each build.

Differential Revision: https://reviews.llvm.org/D39298

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317694 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08 14:31:51 +00:00
Hans Wennborg
2c99ae89ab Revert r316064 "Fix the incorrect detection of ICONV_LIBRARY_PATH"
This broke the use of libxml2 on machines where iconv() is provided by libc.
I'll follow up on the mailing list to discuss how to fix this properly.

> This is introduced in rL308711.
> Check for c library is incorrect here just because libc will be found always
> and it does not mean that iconv is presented.
>
> Thank to Andrew Krasny for narrowing down the root cause.
>
> Reviewers: ecbeckmann
> Reviewed By: ecbeckmann
> Subscribers: mgorny, llvm-commits
> Differential Revision: https://reviews.llvm.org/D38875

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317517 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-06 22:17:23 +00:00
Aaron Ballman
3639f55155 Move the srpm, ocaml_make_directory, llvm_vcsrevision_h, and llvm-headers projects into the Misc folder on IDEs like Visual Studio rather than leave them in the root directory. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317416 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-04 19:59:14 +00:00
NAKAMURA Takumi
5473af6661 CMake: Let LLVM_BUILD_32_BITS aware of large file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317402 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-04 06:03:29 +00:00
Shoaib Meenai
6c2f3c2761 [cmake] Make check_linker_flags operate via linker flags
`check_linker_flags` currently sets the *compiler* flags (via
`CMAKE_REQUIRED_FLAGS`), and thus implicitly relies on cmake's default
behavior of passing the compiler flags to the linker. This breaks when
cmake's build rules have been altered to not pollute the link line with
compiler flags (which can be desirable for build cleanliness). Instead,
set `CMAKE_EXE_LINKER_FLAGS` explicitly and use `CMP0056` to ensure the
linker flags are passed along. Additionally, since we're inside a
function, we can just alter the variable directly (as the alteration
will be limited to the scope of the function) rather than saving and
restoring the old value.

Differential Revision: https://reviews.llvm.org/D39431

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316972 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-31 01:30:46 +00:00
Rui Ueyama
c831070a70 Fix -fuse-ld feature detection error.
check_cxx_compiler_flag doesn't seem to try to link a program, so
the existing code doesn't correctly detect the availability of a given
linker.  This patch uses check_cxx_source_compiles instead.

I confirmed that cmake now reports this error

  Host compiler does not support '-fuse-ld=foo'

for -DLLVM_USE_LINKER=foo.

Differential Revision: https://reviews.llvm.org/D39274

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316958 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 21:19:54 +00:00
Tim Shen
228b83b879 [CMake] Fix linker detection in AddLLVM.cmake
Fix linker not being correctly detected when a custom one is specified
through LLVM_USE_LINKER CMake variable.

In particular,

  cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold ../llvm

resulted into

  Linker detection: GNU ld

instead of

  Linker detection: GNU Gold

due to the construction not accounting for such variable. It led to the general
confusion and prevented setting linker-specific flags inside functions defined
in AddLLVM.cmake.

Thanks Oleksii Vilchanskyi for the patch!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316956 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 21:12:14 +00:00
Zachary Turner
67384e3ffa Force #define GTEST_LANG_CXX11.
gtest depends on this #define to determine whether it can
use various classes like std::tuple, or whether it has to fall
back to experimental classes in the std::tr1 namespace.  The
check in the current version of gtest relies on the value of
the `__cplusplus` macro, but MSVC provides a non-conformant
value of this macro, making it effectively impossible to detect
C++11.  In short, LLVM compiled with MSVC has been silently
using the tr1 versions of several classes since the beginning of
time.

This would normally be pretty benign, except that in the latest
preview of MSVC they have marked all of the tr1 classes
deprecated, so it spews thousands of warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316798 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 21:12:28 +00:00
Shoaib Meenai
7f40466d3b [cmake] Restrict resource file usage to Windows build hosts
Resource file compilation requires a working resource compiler.
Unfortunately, llvm-rc isn't quite there yet [1], and cmake's rc
invocation only works on Windows [2]. Until both those issues are
addressed, disable resource file usage on non-Windows build hosts, to
unblock Windows cross-compilation. This is also consistent with the
existing comment, which says "If *on Windows* and building with MSVC".

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118433.html
[2] https://public.kitware.com/pipermail/cmake/2017-October/066441.html

Differential Revision: https://reviews.llvm.org/D39265

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316594 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 17:11:28 +00:00
Vassil Vassilev
2f9c707df3 Revert 316150 which reinstated r316025.
It fails on some bots and now we know how to reproduce it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316153 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19 08:44:19 +00:00
Vassil Vassilev
4c329eb4fd Reinstate r316025, reverted in r316029.
Original commit message:
"[cmake] Use find_package to discover zlib

This allows us to use standard cmake utilities to point to non-system zlib
locations.

Patch by Oksana Shadura and me (D39002)."

The new patch brings back the old behavior in the cases where find_package
cannot find zlib.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316150 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19 08:04:22 +00:00
Serguei Katkov
eb8a5a38be Fix the incorrect detection of ICONV_LIBRARY_PATH
This is introduced in rL308711.
Check for c library is incorrect here just because libc will be found always
and it does not mean that iconv is presented.

Thank to Andrew Krasny for narrowing down the root cause.

Reviewers: ecbeckmann
Reviewed By: ecbeckmann
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D38875

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316064 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-18 06:26:39 +00:00
Vassil Vassilev
33287ae950 Revert "[cmake] Use find_package to discover zlib"
We are investigating what went wrong.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316029 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-17 20:51:25 +00:00
Vassil Vassilev
1c1c256fbc [cmake] Use find_package to discover zlib
This allows us to use standard cmake utilities to point to non-system zlib
locations.

Patch by Oksana Shadura and me (D39002).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316025 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-17 20:32:27 +00:00
Nico Weber
d03e64f753 Search for libxml2 on macOS too.
This allows lld-link to process /manifestinput: flags on macOS too.
Also makes the `REQUIRES: manifesttool` lld tests run on macOS.
Setting LLVM_ENABLE_LIBXML2 to off can suppress this behavior, like on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-15 19:13:57 +00:00
Matt Morehouse
8520e4812b [cmake] Allow building fuzzers with OSS-Fuzz flags.
Reviewers: kcc, bogner

Reviewed By: bogner

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D38858

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315629 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12 21:58:41 +00:00
Rafael Espindola
a72e2a9037 Bring r314809 back.
But now include a check for CPU_COUNT so we still build on 10 year old
versions of glibc.

Original message:

Use sched_getaffinity instead of std:🧵:hardware_concurrency.

The issue with std:🧵:hardware_concurrency is that it forwards
to libc and some implementations (like glibc) don't take thread
affinity into consideration.

With this change a llvm program that can execute in only 2 cores will
use 2 threads, even if the machine has 32 cores.

This makes benchmarking a lot easier, but should also help if someone
doesn't want to use all cores for compilation for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314931 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04 20:27:01 +00:00
Daniel Neilson
9f2abf5c52 Revert D38481 due to missing cmake check for CPU_COUNT
Summary:
This reverts D38481. The change breaks systems with older versions of glibc. It
injects a use of CPU_COUNT() from sched.h without checking to ensure that the
function exists first.

Reviewers:

Subscribers:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04 18:19:03 +00:00
Rafael Espindola
70deadb171 Use sched_getaffinity instead of std:🧵:hardware_concurrency.
The issue with std:🧵:hardware_concurrency is that it forwards
to libc and some implementations (like glibc) don't take thread
affinity into consideration.

With this change a llvm program that can execute in only 2 cores will
use 2 threads, even if the machine has 32 cores.

This makes benchmarking a lot easier, but should also help if someone
doesn't want to use all cores for compilation for example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314809 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-03 16:25:15 +00:00
Brian Gesiak
35bfb7ddfe Revert "[CMake] Remove CMAKE_.*_OUTPUT_DIRECTORY (NFCI)"
Summary:
It appears polly makes use of the `CMAKE_RUNTIME_OUTPUT_DIRECTORY` variable
when configuring its lit test suite. Reverting this for now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314551 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29 19:50:41 +00:00
Brian Gesiak
7369201851 [CMake] Remove CMAKE_.*_OUTPUT_DIRECTORY (NFCI)
Summary:
Three `CMAKE_.*_OUTPUT_DIRECTORY` variables used to be set in CMake and
referenced in various other parts of the project. However, in r198205
chapuni added a note to "don't set them anymore", and any remaining
references to them were subsequently removed in r198316 and r199592.

Now that the variables are no longer used anywhere, remove them, along
with the comments advising against using them any longer.

Test Plan:
I ran `check-all` and confirmed the tests built and passed.

Reviewers: beanz, chapuni

Reviewed By: beanz

Subscribers: mgorny

Differential Revision: https://reviews.llvm.org/D38389

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314550 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29 19:34:57 +00:00
Don Hinton
de9cae20fe Cleanup some problems with LLVM_ENABLE_DUMP in release builds, and
always set LLVM_ENABLE_DUMP=ON for +Asserts builds.

Differential Revision: https://reviews.llvm.org/D38306

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314346 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27 21:19:56 +00:00
Matthias Braun
ec9231b4ba CMake: Add option to set LLVM_ENABLE_DUMP
Differential Revision: https://reviews.llvm.org/D38267

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314186 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26 02:36:58 +00:00
Zachary Turner
2462b0299b [lit] Add a test for the builtin config map.
Config map is not exposed through the command line, so testing this
is somewhat tricky.  But basically we need a test that if a custom
driver builds a config map and passes it to main, it gets respected.

A config map allows config files in the source tree to be mapped
to alternate config files in the build tree.  This particular test
works by having two config files in separate directories, and
setting up a config map to have that redirects A/lit.site.cfg
to B/altconfig.  Then, we print a message in A/lit.site.cfg
and B/altconfig and check that we do see the output from B
but don't see the output from A.  Additionally we test that
the test suite specified by A's config map is properly discovered.

Differential Revision: https://reviews.llvm.org/D38105

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313887 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 16:18:28 +00:00
Zachary Turner
1e4a125226 [lit] Make lit support config files with .py extension.
Many editors and Python-related diagnostics tools such as
debuggers break or fail in mysterious ways when python files
don't end in .py.  This is especially true on Windows, but
still exists on other platforms.  I don't want to be too heavy
handed in changing everything across the board, but I do want
to at least *allow* lit configs to have .py extensions.  This
patch makes the discovery process first look for a config file
with a .py extension, and if one is not found, then looks for
a config file using the old method.  So for existing users, there
should be no functional change.

Differential Revision: https://reviews.llvm.org/D37838

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 00:24:52 +00:00
Vedant Kumar
a08053624b [cmake] Add an option to build llvm with IR PGO
This adds an LLVM_ENABLE_IR_PGO option to enable building llvm and its
tools with IR PGO instrumentation.

Usage: -DLLVM_BUILD_INSTRUMENTED=On -DLLVM_ENABLE_IR_PGO=On (both
options must be enabled)

Differential Revision: https://reviews.llvm.org/D38066

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313770 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 17:16:01 +00:00
Vedant Kumar
580fbe1a5e [cmake] Unmark LLVM_BUILD_INSTRUMENTED_COVERAGE as experimental
The coverage bot has been stable for a while:

  http://lab.llvm.org:8080/coverage/coverage-reports/index.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 17:16:00 +00:00
Zachary Turner
fd4d2852f0 Make libcxx tests work when llvm sources are not present.
Despite a strong CMake warning that this is an unsupported
libcxx build configuration, some bots still rely on being
able to check out lit and libcxx independently with no
LLVM sources, and then run lit against libcxx.

A previous patch broke that workflow, so this is making it work
again.  Unfortunately, it breaks generation of the llvm-lit
script for libcxx, but we will just have to live with that until
a solution is found that allows libcxx to make more use of
llvm build pieces.  libcxx can still run tests by using the
ninja check target, or by running lit.py directly against the
build tree or source tree.

Differential Revision: https://reviews.llvm.org/D38057

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313763 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 16:01:50 +00:00
Shoaib Meenai
6d72a2f921 [cmake] Add SOURCE_DIR argument to llvm_check_source_file_list
The motivation is to be able to check sources outside the current
directory. See D31363 for example usage.

Differential Revision: https://reviews.llvm.org/D37859

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313648 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 17:44:42 +00:00
Zachary Turner
058162edd3 Resubmit "Fix llvm-lit script generation in libcxx."
After speaking with the libcxx owners, they agreed that this is
a bug in the bot that needs to be fixed by the bot owners, and
the CMake changes are correct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313643 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 17:19:10 +00:00
Zachary Turner
bfc7639dd1 Revert "Fix llvm-lit script generation in libcxx."
This reverts commit 4ad71811d45268d81b60f27e3b8b2bcbc23bd7b9.

There is a bot that is checking out libcxx and lit with nothing
else and then running lit.py against the test tree.  Since there's
no LLVM source tree, there's no LLVM CMake.  CMake actually
reports this as a warning saying unsupported libcxx configuration,
but I guess someone is depending on it anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313607 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 03:11:35 +00:00
Zachary Turner
a2144731b3 Fix llvm-lit script generation in libcxx.
Differential Revision: https://reviews.llvm.org/D37997

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313606 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 02:46:28 +00:00
Zachary Turner
5f445a03f7 [cmake] Add a simple function to dump all variables.
This is useful when debugging CMake problems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313574 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18 21:52:02 +00:00
Zachary Turner
4af1a22e52 Resubmit "Add a shared llvm.lit module that all test suites can use."
There were some issues surrounding Py2 / Py3 compatibility, but
I've now tested with both Py2 and Py3 and everything seems to
work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313467 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16 18:46:21 +00:00
Zachary Turner
591b934d84 Revert lit changes related to lit.llvm module.
It looks like this is going to be non-trivial to get working
in both Py2 and Py3, so for now I'm reverting until I have time
to fully test it under Python 3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313429 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16 00:52:49 +00:00
Zachary Turner
6368f9154b Resubmit "[lit] Add a lit.llvm module that all llvm projects can use"
This was reverted alongside the revert of the lit/llvm-lit refactor,
but now that that has re-landed, I'm relanding this as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313426 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16 00:25:58 +00:00
Zachary Turner
a0f1ea32df Resubmit "[lit] Force site configs to run before source-tree configs"
This is a resubmission of r313270.  It broke standalone builds of
compiler-rt because we were not correctly generating the llvm-lit
script in the standalone build directory.

The fixes incorporated here attempt to find llvm/utils/llvm-lit
from the source tree returned by llvm-config.  If present, it
will generate llvm-lit into the output directory.  Regardless,
the user can specify -DLLVM_EXTERNAL_LIT to point to a specific
lit.py on their file system.  This supports the use case of
someone installing lit via a package manager.  If it cannot find
a source tree, and -DLLVM_EXTERNAL_LIT is either unspecified or
invalid, then we print a warning that tests will not be able
to run.

Differential Revision: https://reviews.llvm.org/D37756

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313407 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 22:10:46 +00:00
Zachary Turner
b411a75bae Revert "[lit] Force site configs to run before source-tree configs"
This patch is still breaking several multi-stage compiler-rt bots.
I already know what the fix is, but I want to get the bots green
for now and then try re-applying in the morning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313335 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 02:56:40 +00:00
Reid Kleckner
f9c1d433fb [cmake] Fix a variable shadowing bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313331 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 01:18:46 +00:00
Zachary Turner
3cdfdbb5e8 [lit] Revert "Add a lit.llvm module that all llvm projects can use"
This is breaking due to some changes I forgot to merge in, so I'm
temporarily reverting them until I can re-test that this works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313328 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 00:56:08 +00:00
Zachary Turner
d5831d289e [lit] Add a lit.llvm module that all test suites can use.
To further reduce duplicate code, this patch introduces a module
that configs can simply import and get access to a lot of useful
functionality such as setting up paths, adding features that are
useful across all projects, and other utility-type functions.

For now this only updates llvm's suite to use this new library,
but subsequent patches will update other projects.

Differential Revision: https://reviews.llvm.org/D37778

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313325 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 00:34:00 +00:00
Zachary Turner
837d04db84 [lit] Force site configs to be run before source-tree configs
This patch simplifies LLVM's lit infrastructure by enforcing an ordering
that a site config is always run before a source-tree config.

A significant amount of the complexity from lit config files arises from
the fact that inside of a source-tree config file, we don't yet know if
the site config has been run.  However it is *always* required to run
a site config first, because it passes various variables down through
CMake that the main config depends on.  As a result, every config
file has to do a bunch of magic to try to reverse-engineer the location
of the site config file if they detect (heuristically) that the site
config file has not yet been run.

This patch solves the problem by emitting a mapping from source tree
config file to binary tree site config file in llvm-lit.py. Then, during
discovery when we find a config file, we check to see if we have a
target mapping for it, and if so we use that instead.

This mechanism is generic enough that it does not affect external users
of lit. They will just not have a config mapping defined, and everything
will work as normal.

On the other hand, for us it allows us to make many simplifications:

* We are guaranteed that a site config will be executed first
* Inside of a main config, we no longer have to assume that attributes
  might not be present and use getattr everywhere.
* We no longer have to pass parameters such as --param llvm_site_config=<path>
  on the command line.
* It is future-proof, meaning you don't have to edit llvm-lit.in to add
  support for new projects.
* All of the duplicated logic of trying various fallback mechanisms of
  finding a site config from the main config are now gone.

One potentially noteworthy thing that was required to implement this
change is that whereas the ninja check targets previously used the first
method to spawn lit, they now use the second. In particular, you can no
longer run lit.py against the source tree while specifying the various
`foo_site_config=<path>` parameters.  Instead, you need to run
llvm-lit.py.

Differential Revision: https://reviews.llvm.org/D37756

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313270 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-14 16:47:58 +00:00