2017-01-06 22:33:48 +01:00
|
|
|
llvm_canonicalize_cmake_booleans(
|
2019-01-19 01:10:54 +01:00
|
|
|
BUILD_SHARED_LIBS
|
2021-05-19 17:07:39 +02:00
|
|
|
LLVM_HAVE_LIBXAR
|
2017-01-06 22:33:48 +01:00
|
|
|
HAVE_OCAMLOPT
|
|
|
|
HAVE_OCAML_OUNIT
|
|
|
|
LLVM_ENABLE_DIA_SDK
|
2017-01-06 22:33:54 +01:00
|
|
|
LLVM_ENABLE_FFI
|
2018-09-26 18:26:59 +02:00
|
|
|
LLVM_ENABLE_THREADS
|
2020-04-30 22:07:13 +02:00
|
|
|
LLVM_ENABLE_ZLIB
|
2020-07-25 00:47:38 +02:00
|
|
|
LLVM_ENABLE_LIBXML2
|
2019-01-19 01:10:54 +01:00
|
|
|
LLVM_INCLUDE_GO_TESTS
|
2017-10-18 21:37:30 +02:00
|
|
|
LLVM_LINK_LLVM_DYLIB
|
2019-01-19 01:10:54 +01:00
|
|
|
LLVM_TOOL_LTO_BUILD
|
|
|
|
LLVM_USE_INTEL_JITEVENTS
|
2019-02-21 23:24:53 +01:00
|
|
|
LLVM_BUILD_EXAMPLES
|
2019-05-17 08:41:04 +02:00
|
|
|
LLVM_ENABLE_PLUGINS
|
2020-01-03 15:39:28 +01:00
|
|
|
LLVM_BYE_LINK_INTO_TOOLS
|
2020-06-29 17:44:38 +02:00
|
|
|
LLVM_HAVE_TF_AOT
|
2020-07-16 01:02:15 +02:00
|
|
|
LLVM_HAVE_TF_API
|
2020-09-16 23:51:41 +02:00
|
|
|
LLVM_ENABLE_EXPENSIVE_CHECKS
|
2017-10-18 21:37:30 +02:00
|
|
|
)
|
2017-01-06 22:33:48 +01:00
|
|
|
|
2012-06-28 08:36:24 +02:00
|
|
|
configure_lit_site_cfg(
|
2017-09-21 02:24:52 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
|
|
|
MAIN_CONFIG
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
|
2020-04-02 21:51:58 +02:00
|
|
|
PATHS
|
2021-06-22 21:20:05 +02:00
|
|
|
"CMAKE_OSX_SYSROOT"
|
2020-04-02 21:51:58 +02:00
|
|
|
"LLVM_SOURCE_DIR"
|
|
|
|
"LLVM_BINARY_DIR"
|
|
|
|
"LLVM_TOOLS_DIR"
|
2021-02-11 18:32:20 +01:00
|
|
|
"LLVM_LIBS_DIR"
|
2020-04-02 21:51:58 +02:00
|
|
|
"SHLIBDIR"
|
2012-06-28 08:36:24 +02:00
|
|
|
)
|
|
|
|
configure_lit_site_cfg(
|
2017-09-21 02:24:52 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
|
|
|
|
MAIN_CONFIG
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
|
2020-04-02 21:51:58 +02:00
|
|
|
PATHS
|
|
|
|
"LLVM_SOURCE_DIR"
|
|
|
|
"LLVM_BINARY_DIR"
|
|
|
|
"LLVM_TOOLS_DIR"
|
|
|
|
"SHLIBDIR"
|
2012-06-28 08:36:24 +02:00
|
|
|
)
|
2009-09-22 09:38:44 +02:00
|
|
|
|
2012-11-21 21:38:26 +01:00
|
|
|
# Set the depends list as a variable so that it can grow conditionally.
|
2013-10-29 00:37:49 +01:00
|
|
|
# NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
|
2013-07-08 10:44:30 +02:00
|
|
|
set(LLVM_TEST_DEPENDS
|
|
|
|
BugpointPasses
|
2015-11-12 20:34:21 +01:00
|
|
|
FileCheck
|
2013-07-08 10:44:30 +02:00
|
|
|
LLVMHello
|
2015-11-12 20:34:21 +01:00
|
|
|
UnitTests
|
2014-03-04 17:13:30 +01:00
|
|
|
bugpoint
|
2015-11-12 20:34:21 +01:00
|
|
|
count
|
2013-07-08 10:44:30 +02:00
|
|
|
llc
|
|
|
|
lli
|
2013-10-03 00:27:23 +02:00
|
|
|
lli-child-target
|
2019-04-19 12:17:52 +02:00
|
|
|
llvm-addr2line
|
2013-07-08 10:44:30 +02:00
|
|
|
llvm-ar
|
|
|
|
llvm-as
|
|
|
|
llvm-bcanalyzer
|
2020-09-19 03:11:22 +02:00
|
|
|
llvm-bitcode-strip
|
2013-10-23 19:57:04 +02:00
|
|
|
llvm-c-test
|
2016-11-29 21:43:47 +01:00
|
|
|
llvm-cat
|
2017-11-01 01:49:45 +01:00
|
|
|
llvm-cfi-verify
|
2015-11-12 20:34:21 +01:00
|
|
|
llvm-config
|
2013-07-08 10:44:36 +02:00
|
|
|
llvm-cov
|
2017-04-21 22:45:11 +02:00
|
|
|
llvm-cvtres
|
2018-04-23 16:28:49 +02:00
|
|
|
llvm-cxxdump
|
|
|
|
llvm-cxxfilt
|
2018-09-13 23:15:34 +02:00
|
|
|
llvm-cxxmap
|
2013-07-08 10:44:30 +02:00
|
|
|
llvm-diff
|
|
|
|
llvm-dis
|
2017-07-18 23:26:38 +02:00
|
|
|
llvm-dlltool
|
2018-03-18 12:38:41 +01:00
|
|
|
dsymutil
|
2013-07-08 10:44:30 +02:00
|
|
|
llvm-dwarfdump
|
2015-12-01 01:57:05 +01:00
|
|
|
llvm-dwp
|
2018-09-25 15:59:35 +02:00
|
|
|
llvm-exegesis
|
2014-10-23 04:33:23 +02:00
|
|
|
llvm-extract
|
2020-02-26 19:30:04 +01:00
|
|
|
llvm-gsymutil
|
2017-09-03 05:00:27 +02:00
|
|
|
llvm-isel-fuzzer
|
2019-08-30 20:26:05 +02:00
|
|
|
llvm-ifs
|
2019-11-20 08:30:52 +01:00
|
|
|
llvm-install-name-tool
|
2019-04-22 04:23:09 +02:00
|
|
|
llvm-jitlink
|
2015-06-09 23:50:22 +02:00
|
|
|
llvm-lib
|
2020-07-01 23:41:07 +02:00
|
|
|
llvm-libtool-darwin
|
2012-11-01 03:13:50 +01:00
|
|
|
llvm-link
|
2019-05-29 01:22:12 +02:00
|
|
|
llvm-lipo
|
2019-12-18 09:54:21 +01:00
|
|
|
llvm-locstats
|
2016-08-11 16:58:12 +02:00
|
|
|
llvm-lto2
|
2012-11-01 03:13:50 +01:00
|
|
|
llvm-mc
|
2018-03-08 15:43:24 +01:00
|
|
|
llvm-mca
|
2020-01-20 15:18:25 +01:00
|
|
|
llvm-ml
|
2016-11-29 22:54:33 +01:00
|
|
|
llvm-modextract
|
2017-07-21 00:13:16 +02:00
|
|
|
llvm-mt
|
2012-11-01 03:13:50 +01:00
|
|
|
llvm-nm
|
2017-08-01 02:33:58 +02:00
|
|
|
llvm-objcopy
|
2012-11-01 03:13:50 +01:00
|
|
|
llvm-objdump
|
2018-04-23 16:28:49 +02:00
|
|
|
llvm-opt-fuzzer
|
Add an llvm-opt-report tool to generate basic source-annotated optimization summaries
LLVM now has the ability to record information from optimization remarks in a
machine-consumable YAML file for later analysis. This can be enabled in opt
(see r282539), and D25225 adds a Clang flag to do the same. This patch adds
llvm-opt-report, a tool to generate basic optimization "listing" files
(annotated sources with information about what optimizations were performed)
from one of these YAML inputs.
D19678 proposed to add this capability directly to Clang, but this more-general
YAML-based infrastructure was the direction we decided upon in that review
thread.
For this optimization report, I focused on making the output as succinct as
possible while providing information on inlining and loop transformations. The
goal here is that the source code should still be easily readable in the
report. My primary inspiration here is the reports generated by Cray's tools
(http://docs.cray.com/books/S-2496-4101/html-S-2496-4101/z1112823641oswald.html).
These reports are highly regarded within the HPC community. Intel's compiler,
for example, also has an optimization-report capability
(https://software.intel.com/sites/default/files/managed/55/b1/new-compiler-optimization-reports.pdf).
$ cat /tmp/v.c
void bar();
void foo() { bar(); }
void Test(int *res, int *c, int *d, int *p, int n) {
int i;
#pragma clang loop vectorize(assume_safety)
for (i = 0; i < 1600; i++) {
res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
}
for (i = 0; i < 16; i++) {
res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
}
foo();
foo(); bar(); foo();
}
D25225 adds -fsave-optimization-record (and
-fsave-optimization-record=filename), and this would be used as follows:
$ clang -O3 -o /tmp/v.o -c /tmp/v.c -fsave-optimization-record
$ llvm-opt-report /tmp/v.yaml > /tmp/v.lst
$ cat /tmp/v.lst
< /tmp/v.c
2 | void bar();
3 | void foo() { bar(); }
4 |
5 | void Test(int *res, int *c, int *d, int *p, int n) {
6 | int i;
7 |
8 | #pragma clang loop vectorize(assume_safety)
9 V4,2 | for (i = 0; i < 1600; i++) {
10 | res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
11 | }
12 |
13 U16 | for (i = 0; i < 16; i++) {
14 | res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
15 | }
16 |
17 I | foo();
18 |
19 | foo(); bar(); foo();
I | ^
I | ^
20 | }
Each source line gets a prefix giving the line number, and a few columns for
important optimizations: inlining, loop unrolling and loop vectorization. An
'I' is printed next to a line where a function was inlined, a 'U' next to an
unrolled loop, and 'V' next to a vectorized loop. These are printed on the
relevant code line when that seems unambiguous, or on subsequent lines when
multiple potential options exist (messages, both positive and negative, from
the same optimization with different column numbers are taken to indicate
potential ambiguity). When on subsequent lines, a '^' is output in the relevant
column.
Annotated source for all relevant input files are put into the listing file
(each starting with '<' and then the file name).
You can disable having the unrolling/vectorization factors appear by using the
-s flag.
Differential Revision: https://reviews.llvm.org/D25262
llvm-svn: 283398
2016-10-06 00:10:35 +02:00
|
|
|
llvm-opt-report
|
2021-04-15 16:55:22 +02:00
|
|
|
llvm-otool
|
2017-06-09 22:46:17 +02:00
|
|
|
llvm-pdbutil
|
2014-02-18 00:22:49 +01:00
|
|
|
llvm-profdata
|
2020-12-09 18:34:51 +01:00
|
|
|
llvm-profgen
|
2014-12-04 02:34:11 +01:00
|
|
|
llvm-ranlib
|
2017-07-25 03:44:38 +02:00
|
|
|
llvm-rc
|
2012-11-01 03:13:50 +01:00
|
|
|
llvm-readobj
|
2017-07-19 04:09:37 +02:00
|
|
|
llvm-readelf
|
2019-08-09 00:16:33 +02:00
|
|
|
llvm-reduce
|
2013-01-26 00:24:07 +01:00
|
|
|
llvm-rtdyld
|
2021-06-07 17:57:39 +02:00
|
|
|
llvm-sim
|
2014-12-04 02:27:53 +01:00
|
|
|
llvm-size
|
2015-08-21 04:48:20 +02:00
|
|
|
llvm-split
|
2021-07-22 18:37:01 +02:00
|
|
|
llvm-stress
|
2016-11-12 04:45:21 +01:00
|
|
|
llvm-strings
|
2018-05-08 00:00:59 +02:00
|
|
|
llvm-strip
|
2013-03-13 10:35:18 +01:00
|
|
|
llvm-symbolizer
|
2014-01-18 20:01:08 +01:00
|
|
|
llvm-tblgen
|
2021-06-10 06:13:31 +02:00
|
|
|
llvm-tapi-diff
|
2018-07-20 20:42:19 +02:00
|
|
|
llvm-undname
|
[llvm-rc] Add a GNU windres-like frontend to llvm-rc
This primarily parses a different set of options and invokes the same
resource compiler as llvm-rc normally. Additionally, it can convert
directly to an object file (which in MSVC style setups is done with the
separate cvtres tool, or by the linker).
(GNU windres also supports other conversions; from coff object file back
to .res, and from .res or object file back to .rc form; that's not yet
implemented.)
The other bigger complication lies in being able to imply or pass the
intended target triple, to let clang find the corresponding mingw sysroot
for finding include files, and for specifying the default output object
machine format.
It can be implied from the tool triple prefix, like
`<triple>-[llvm-]windres` or picked up from the windres option e.g.
`-F pe-x86-64`. In GNU windres, that option takes BFD style format names
such as pe-i386 or pe-x86-64. As libbfd in binutils doesn't support
Windows on ARM, there's no such canonical name for the ARM targets.
Therefore, as an LLVM specific extension, this option is extended to
allow passing full triples, too.
Differential Revision: https://reviews.llvm.org/D100756
2021-04-15 13:38:27 +02:00
|
|
|
llvm-windres
|
2016-10-26 06:16:05 +02:00
|
|
|
llvm-xray
|
2013-07-08 10:44:30 +02:00
|
|
|
not
|
|
|
|
obj2yaml
|
2015-11-12 20:34:21 +01:00
|
|
|
opt
|
|
|
|
sancov
|
2016-01-16 01:31:11 +01:00
|
|
|
sanstats
|
2020-08-03 19:17:55 +02:00
|
|
|
split-file
|
2014-07-30 19:11:27 +02:00
|
|
|
verify-uselistorder
|
2015-11-12 20:34:21 +01:00
|
|
|
yaml-bench
|
|
|
|
yaml2obj
|
2013-07-08 10:44:30 +02:00
|
|
|
)
|
2012-11-21 21:38:26 +01:00
|
|
|
|
2016-06-02 18:29:07 +02:00
|
|
|
if(TARGET llvm-lto)
|
|
|
|
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-lto)
|
|
|
|
endif()
|
|
|
|
|
2012-11-21 21:38:26 +01:00
|
|
|
# If Intel JIT events are supported, depend on a tool that tests the listener.
|
|
|
|
if( LLVM_USE_INTEL_JITEVENTS )
|
|
|
|
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-jitlistener)
|
|
|
|
endif( LLVM_USE_INTEL_JITEVENTS )
|
|
|
|
|
2014-09-11 00:20:49 +02:00
|
|
|
if(TARGET LLVMgold)
|
|
|
|
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LLVMgold)
|
|
|
|
endif()
|
|
|
|
|
2020-02-24 18:11:15 +01:00
|
|
|
if(TARGET llvm-go)
|
|
|
|
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} llvm-go)
|
|
|
|
endif()
|
|
|
|
|
2016-06-02 18:29:07 +02:00
|
|
|
if(TARGET LTO)
|
2015-03-20 00:55:38 +01:00
|
|
|
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS} LTO)
|
|
|
|
endif()
|
|
|
|
|
2016-11-12 15:58:30 +01:00
|
|
|
if(LLVM_BUILD_EXAMPLES)
|
|
|
|
list(APPEND LLVM_TEST_DEPENDS
|
|
|
|
Kaleidoscope-Ch3
|
|
|
|
Kaleidoscope-Ch4
|
|
|
|
Kaleidoscope-Ch5
|
|
|
|
Kaleidoscope-Ch6
|
|
|
|
Kaleidoscope-Ch7
|
2020-08-26 20:44:57 +02:00
|
|
|
LLJITWithThinLTOSummaries
|
2021-06-30 21:44:54 +02:00
|
|
|
OrcV2CBindingsBasicUsage
|
|
|
|
OrcV2CBindingsAddObjectFile
|
|
|
|
OrcV2CBindingsRemovableCode
|
|
|
|
OrcV2CBindingsReflectProcessSymbols
|
2021-06-30 21:47:43 +02:00
|
|
|
OrcV2CBindingsLazy
|
2021-07-18 16:22:34 +02:00
|
|
|
OrcV2CBindingsVeryLazy
|
2016-11-12 15:58:30 +01:00
|
|
|
)
|
2021-03-30 03:04:02 +02:00
|
|
|
if(CMAKE_HOST_UNIX)
|
|
|
|
list(APPEND LLVM_TEST_DEPENDS
|
|
|
|
LLJITWithRemoteDebugging
|
|
|
|
)
|
|
|
|
endif()
|
2020-05-12 10:54:51 +02:00
|
|
|
if (NOT WIN32)
|
|
|
|
list(APPEND LLVM_TEST_DEPENDS
|
|
|
|
Bye
|
|
|
|
)
|
|
|
|
endif()
|
2016-11-12 15:58:30 +01:00
|
|
|
endif()
|
|
|
|
|
2014-12-01 20:50:23 +01:00
|
|
|
if(TARGET ocaml_llvm)
|
2016-11-12 15:58:30 +01:00
|
|
|
# Clear all non-OCaml cross-target dependencies when building out-of-tree.
|
|
|
|
if(LLVM_OCAML_OUT_OF_TREE)
|
|
|
|
set(LLVM_TEST_DEPENDS)
|
|
|
|
endif()
|
|
|
|
|
2014-12-01 20:50:23 +01:00
|
|
|
set(LLVM_TEST_DEPENDS ${LLVM_TEST_DEPENDS}
|
|
|
|
ocaml_llvm
|
|
|
|
ocaml_llvm_all_backends
|
|
|
|
ocaml_llvm_analysis
|
|
|
|
ocaml_llvm_bitreader
|
|
|
|
ocaml_llvm_bitwriter
|
|
|
|
ocaml_llvm_executionengine
|
|
|
|
ocaml_llvm_irreader
|
|
|
|
ocaml_llvm_linker
|
|
|
|
ocaml_llvm_target
|
|
|
|
ocaml_llvm_ipo
|
|
|
|
ocaml_llvm_passmgr_builder
|
|
|
|
ocaml_llvm_scalar_opts
|
2014-12-01 20:50:39 +01:00
|
|
|
ocaml_llvm_transform_utils
|
2014-12-01 20:50:23 +01:00
|
|
|
ocaml_llvm_vectorize
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-03-02 01:27:14 +01:00
|
|
|
add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
|
2016-04-12 17:09:14 +02:00
|
|
|
set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
|
2016-03-02 01:27:14 +01:00
|
|
|
|
2020-02-07 00:26:10 +01:00
|
|
|
if(LLVM_BUILD_TOOLS)
|
|
|
|
set(exclude_from_check_all "")
|
2020-02-08 00:12:05 +01:00
|
|
|
else()
|
|
|
|
set(exclude_from_check_all "EXCLUDE_FROM_CHECK_ALL")
|
2020-02-07 00:26:10 +01:00
|
|
|
endif()
|
|
|
|
|
2012-11-21 21:38:26 +01:00
|
|
|
add_lit_testsuite(check-llvm "Running the LLVM regression tests"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2020-02-07 00:26:10 +01:00
|
|
|
${exclude_from_check_all}
|
2012-11-21 21:38:26 +01:00
|
|
|
DEPENDS ${LLVM_TEST_DEPENDS}
|
2012-06-27 11:44:16 +02:00
|
|
|
)
|
2012-06-30 12:14:14 +02:00
|
|
|
set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
|
2010-12-10 03:15:36 +01:00
|
|
|
|
2015-03-25 09:07:47 +01:00
|
|
|
add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
|
2020-02-07 00:26:10 +01:00
|
|
|
${exclude_from_check_all}
|
2015-03-25 09:07:47 +01:00
|
|
|
DEPENDS ${LLVM_TEST_DEPENDS}
|
|
|
|
)
|
|
|
|
|
2020-05-29 20:16:23 +02:00
|
|
|
# Setup an alias for 'check-all'.
|
2012-07-02 23:45:22 +02:00
|
|
|
add_custom_target(check)
|
2020-05-29 20:16:23 +02:00
|
|
|
add_dependencies(check check-all)
|
2012-06-30 12:14:14 +02:00
|
|
|
set_target_properties(check PROPERTIES FOLDER "Tests")
|