[cmake] Explicitly mark libraries defined in lib/ as "Component Libraries"
Summary:
Most libraries are defined in the lib/ directory but there are also a
few libraries defined in tools/ e.g. libLLVM, libLTO. I'm defining
"Component Libraries" as libraries defined in lib/ that may be included in
libLLVM.so. Explicitly marking the libraries in lib/ as component
libraries allows us to remove some fragile checks that attempt to
differentiate between lib/ libraries and tools/ libraires:
1. In tools/llvm-shlib, because
llvm_map_components_to_libnames(LIB_NAMES "all") returned a list of
all libraries defined in the whole project, there was custom code
needed to filter out libraries defined in tools/, none of which should
be included in libLLVM.so. This code assumed that any library
defined as static was from lib/ and everything else should be
excluded.
With this change, llvm_map_components_to_libnames(LIB_NAMES, "all")
only returns libraries that have been added to the LLVM_COMPONENT_LIBS
global cmake property, so this custom filtering logic can be removed.
Doing this also fixes the build with BUILD_SHARED_LIBS=ON
and LLVM_BUILD_LLVM_DYLIB=ON.
2. There was some code in llvm_add_library that assumed that
libraries defined in lib/ would not have LLVM_LINK_COMPONENTS or
ARG_LINK_COMPONENTS set. This is only true because libraries
defined lib lib/ use LLVMBuild.txt and don't set these values.
This code has been fixed now to check if the library has been
explicitly marked as a component library, which should now make it
easier to remove LLVMBuild at some point in the future.
I have tested this patch on Windows, MacOS and Linux with release builds
and the following combinations of CMake options:
- "" (No options)
- -DLLVM_BUILD_LLVM_DYLIB=ON
- -DLLVM_LINK_LLVM_DYLIB=ON
- -DBUILD_SHARED_LIBS=ON
- -DBUILD_SHARED_LIBS=ON -DLLVM_BUILD_LLVM_DYLIB=ON
- -DBUILD_SHARED_LIBS=ON -DLLVM_LINK_LLVM_DYLIB=ON
Reviewers: beanz, smeenai, compnerd, phosek
Reviewed By: beanz
Subscribers: wuzish, jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, mgorny, mehdi_amini, sbc100, jgravelle-google, hiraditya, aheejin, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, dang, Jim, lenary, s.egerton, pzheng, sameer.abuasal, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70179
2019-11-14 13:39:58 +08:00
|
|
|
add_llvm_component_library(LLVMTransformUtils
|
2020-04-02 19:41:24 +08:00
|
|
|
AddDiscriminators.cpp
|
2019-08-22 18:04:35 +08:00
|
|
|
AMDGPUEmitPrintf.cpp
|
2013-12-06 17:00:17 +08:00
|
|
|
ASanStackFrameLayout.cpp
|
2020-04-02 19:41:24 +08:00
|
|
|
AssumeBundleBuilder.cpp
|
2021-02-25 05:19:39 +08:00
|
|
|
AutoInitRemark.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
BasicBlockUtils.cpp
|
|
|
|
BreakCriticalEdges.cpp
|
2010-03-06 06:34:16 +08:00
|
|
|
BuildLibCalls.cpp
|
2012-09-05 02:22:17 +08:00
|
|
|
BypassSlowDivision.cpp
|
2017-12-07 05:22:54 +08:00
|
|
|
CallPromotionUtils.cpp
|
2019-11-30 03:11:24 +08:00
|
|
|
CallGraphUpdater.cpp
|
[ThinLTO] Handle chains of aliases
At -O0, globalopt is not run during the compile step, and we can have a
chain of an alias having an immediate aliasee of another alias. The
summaries are constructed assuming aliases in a canonical form
(flattened chains), and as a result only the base object but no
intermediate aliases were preserved.
Fix by adding a pass that canonicalize aliases, which ensures each
alias is a direct alias of the base object.
Reviewers: pcc, davidxl
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits
Differential Revision: https://reviews.llvm.org/D54507
llvm-svn: 350423
2019-01-05 03:04:54 +08:00
|
|
|
CanonicalizeAliases.cpp
|
Add CanonicalizeFreezeInLoops pass
Summary:
If an induction variable is frozen and used, SCEV yields imprecise result
because it doesn't say anything about frozen variables.
Due to this reason, performance degradation happened after
https://reviews.llvm.org/D76483 is merged, causing
SCEV yield imprecise result and preventing LSR to optimize a loop.
The suggested solution here is to add a pass which canonicalizes frozen variables
inside a loop. To be specific, it pushes freezes out of the loop by freezing
the initial value and step values instead & dropping nsw/nuw flags from instructions used by freeze.
This solution was also mentioned at https://reviews.llvm.org/D70623 .
Reviewers: spatel, efriedma, lebedev.ri, fhahn, jdoerfert
Reviewed By: fhahn
Subscribers: nikic, mgorny, hiraditya, javed.absar, llvm-commits, sanwou01, nlopes
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77523
2020-05-08 04:28:42 +08:00
|
|
|
CanonicalizeFreezeInLoops.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
CloneFunction.cpp
|
|
|
|
CloneModule.cpp
|
|
|
|
CodeExtractor.cpp
|
[CodeMoverUtils] Added an API to check if an instruction can be safely
moved before another instruction.
Summary:Added an API to check if an instruction can be safely moved
before another instruction. In future PRs, we will like to add support
of moving instructions between blocks that are not control flow
equivalent, and add other APIs to enhance usability, e.g. moving basic
blocks, moving list of instructions...
Loop Fusion will be its first user. When there is intervening code in
between two loops, fusion is currently unable to fuse them. Loop Fusion
can use this utility to check if the intervening code can be safely
moved before or after the two loops, and move them, then it can
successfully fuse them.
Reviewer:kbarton,jdoerfert,Meinersbur,bmahjour,etiotto
Reviewed By:bmahjour
Subscribers:mgorny,hiraditya,llvm-commits
Tag:LLVM
Differential Revision:https://reviews.llvm.org/D70049
2019-11-23 05:27:29 +08:00
|
|
|
CodeMoverUtils.cpp
|
2014-11-08 08:00:47 +08:00
|
|
|
CtorUtils.cpp
|
2019-11-07 08:08:01 +08:00
|
|
|
Debugify.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
DemoteRegToStack.cpp
|
2017-11-15 05:09:45 +08:00
|
|
|
EntryExitInstrumenter.cpp
|
2016-11-15 05:41:13 +08:00
|
|
|
EscapeEnumerator.cpp
|
2016-02-03 10:51:00 +08:00
|
|
|
Evaluator.cpp
|
2020-04-15 17:35:51 +08:00
|
|
|
FixIrreducible.cpp
|
2014-11-08 08:00:47 +08:00
|
|
|
FlattenCFG.cpp
|
2016-11-12 05:15:13 +08:00
|
|
|
FunctionComparator.cpp
|
2016-02-11 02:11:31 +08:00
|
|
|
FunctionImportUtils.cpp
|
2013-10-22 01:14:55 +08:00
|
|
|
GlobalStatus.cpp
|
2018-08-29 18:51:59 +08:00
|
|
|
GuardUtils.cpp
|
2021-02-03 08:43:32 +08:00
|
|
|
HelloWorld.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
InlineFunction.cpp
|
2019-11-12 03:42:18 +08:00
|
|
|
InjectTLIMappings.cpp
|
2009-07-22 01:43:20 +08:00
|
|
|
InstructionNamer.cpp
|
2012-09-19 06:02:40 +08:00
|
|
|
IntegerDivision.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
LCSSA.cpp
|
Conditionally eliminate library calls where the result value is not used
Summary:
This pass shrink-wraps a condition to some library calls where the call
result is not used. For example:
sqrt(val);
is transformed to
if (val < 0)
sqrt(val);
Even if the result of library call is not being used, the compiler cannot
safely delete the call because the function can set errno on error
conditions.
Note in many functions, the error condition solely depends on the incoming
parameter. In this optimization, we can generate the condition can lead to
the errno to shrink-wrap the call. Since the chances of hitting the error
condition is low, the runtime call is effectively eliminated.
These partially dead calls are usually results of C++ abstraction penalty
exposed by inlining. This optimization hits 108 times in 19 C/C++ programs
in SPEC2006.
Reviewers: hfinkel, mehdi_amini, davidxl
Subscribers: modocache, mgorny, mehdi_amini, xur, llvm-commits, beanz
Differential Revision: https://reviews.llvm.org/D24414
llvm-svn: 284542
2016-10-19 05:36:27 +08:00
|
|
|
LibCallsShrinkWrap.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
Local.cpp
|
2020-08-01 02:31:58 +08:00
|
|
|
LoopPeel.cpp
|
2018-03-29 16:48:15 +08:00
|
|
|
LoopRotationUtils.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
LoopSimplify.cpp
|
2009-11-03 12:01:53 +08:00
|
|
|
LoopUnroll.cpp
|
2018-07-01 20:47:30 +08:00
|
|
|
LoopUnrollAndJam.cpp
|
2011-12-09 14:19:40 +08:00
|
|
|
LoopUnrollRuntime.cpp
|
2015-04-20 12:38:33 +08:00
|
|
|
LoopUtils.cpp
|
2015-07-11 02:55:13 +08:00
|
|
|
LoopVersioning.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
LowerInvoke.cpp
|
2017-02-09 01:49:52 +08:00
|
|
|
LowerMemIntrinsics.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
LowerSwitch.cpp
|
2020-07-21 01:31:04 +08:00
|
|
|
MatrixUtils.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
Mem2Reg.cpp
|
2018-03-29 01:44:36 +08:00
|
|
|
MetaRenamer.cpp
|
2011-11-01 07:58:51 +08:00
|
|
|
ModuleUtils.cpp
|
2016-09-17 00:56:30 +08:00
|
|
|
NameAnonGlobals.cpp
|
Add PredicateInfo utility and printing pass
Summary:
This patch adds a utility to build extended SSA (see "ABCD: eliminating
array bounds checks on demand"), and an intrinsic to support it. This
is then used to get functionality equivalent to propagateEquality in
GVN, in NewGVN (without having to replace instructions as we go). It
would work similarly in SCCP or other passes. This has been talked
about a few times, so i built a real implementation and tried to
productionize it.
Copies are inserted for operands used in assumes and conditional
branches that are based on comparisons (see below for more)
Every use affected by the predicate is renamed to the appropriate
intrinsic result.
E.g.
%cmp = icmp eq i32 %x, 50
br i1 %cmp, label %true, label %false
true:
ret i32 %x
false:
ret i32 1
will become
%cmp = icmp eq i32, %x, 50
br i1 %cmp, label %true, label %false
true:
; Has predicate info
; branch predicate info { TrueEdge: 1 Comparison: %cmp = icmp eq i32 %x, 50 }
%x.0 = call @llvm.ssa_copy.i32(i32 %x)
ret i32 %x.0
false:
ret i23 1
(you can use -print-predicateinfo to get an annotated-with-predicateinfo dump)
This enables us to easily determine what operations are affected by a
given predicate, and how operations affected by a chain of
predicates.
Reviewers: davide, sanjoy
Subscribers: mgorny, llvm-commits, Prazek
Differential Revision: https://reviews.llvm.org/D29519
Update for review comments
Fix a bug Nuno noticed where we are giving information about and/or on edges where the info is not useful and easy to use wrong
Update for review comments
llvm-svn: 294351
2017-02-08 05:10:46 +08:00
|
|
|
PredicateInfo.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
PromoteMemoryToRegister.cpp
|
2020-05-20 17:08:08 +08:00
|
|
|
ScalarEvolutionExpander.cpp
|
2016-10-22 02:43:16 +08:00
|
|
|
StripGCRelocates.cpp
|
2009-10-10 17:04:27 +08:00
|
|
|
SSAUpdater.cpp
|
2018-04-10 07:37:20 +08:00
|
|
|
SSAUpdaterBulk.cpp
|
2021-02-18 06:19:36 +08:00
|
|
|
SampleProfileLoaderBaseUtil.cpp
|
2016-01-16 08:31:11 +08:00
|
|
|
SanitizerStats.cpp
|
2009-07-22 01:43:20 +08:00
|
|
|
SimplifyCFG.cpp
|
2011-08-10 11:51:58 +08:00
|
|
|
SimplifyIndVar.cpp
|
2012-10-14 00:45:24 +08:00
|
|
|
SimplifyLibCalls.cpp
|
2019-04-16 00:49:00 +08:00
|
|
|
SizeOpts.cpp
|
2015-08-21 10:48:20 +08:00
|
|
|
SplitModule.cpp
|
2016-10-26 02:44:13 +08:00
|
|
|
StripNonLineTableDebugInfo.cpp
|
2014-11-08 08:00:47 +08:00
|
|
|
SymbolRewriter.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
UnifyFunctionExitNodes.cpp
|
2020-03-28 19:13:35 +08:00
|
|
|
UnifyLoopExits.cpp
|
2010-10-08 01:55:47 +08:00
|
|
|
Utils.cpp
|
2008-09-22 09:08:49 +08:00
|
|
|
ValueMapper.cpp
|
2017-03-10 12:54:10 +08:00
|
|
|
VNCoercion.cpp
|
2015-02-11 11:28:02 +08:00
|
|
|
|
|
|
|
ADDITIONAL_HEADER_DIRS
|
|
|
|
${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms
|
|
|
|
${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms/Utils
|
2012-06-24 21:32:01 +08:00
|
|
|
|
2016-11-17 12:36:50 +08:00
|
|
|
DEPENDS
|
|
|
|
intrinsics_gen
|
2020-10-10 00:41:21 +08:00
|
|
|
|
|
|
|
LINK_COMPONENTS
|
|
|
|
Analysis
|
|
|
|
Core
|
|
|
|
Support
|
2016-11-17 12:36:50 +08:00
|
|
|
)
|