llvm-project/llvm
Jessica Paquette 13593843f6 [MachineOutliner] Disable outlining from LinkOnceODRs by default
Say you have two identical linkonceodr functions, one in M1 and one in M2.
Say that the outliner outlines A,B,C from one function, and D,E,F from another
function (where letters are instructions). Now those functions are not
identical, and cannot be deduped. Locally to M1 and M2, these outlining
choices would be good-- to the whole program, however, this might not be true!

To mitigate this, this commit makes it so that the outliner sees linkonceodr
functions as unsafe to outline from. It also adds a flag,
-enable-linkonceodr-outlining, which allows the user to specify that they
want to outline from such functions when they know what they're doing.

Changing this handles most code size regressions in the test suite caused by
competing with linker dedupe. It also doesn't have a huge impact on the code
size improvements from the outliner. There are 6 tests that regress > 5% from
outlining WITH linkonceodrs to outlining WITHOUT linkonceodrs. Overall, most
tests either improve or are not impacted.

Not outlined vs outlined without linkonceodrs:
https://hastebin.com/raw/qeguxavuda

Not outlined vs outlined with linkonceodrs:
https://hastebin.com/raw/edepoqoqic

Outlined with linkonceodrs vs outlined without linkonceodrs:
https://hastebin.com/raw/awiqifiheb

Numbers generated using compare.py with -m size.__text. Tests run for AArch64
with -Oz -mllvm -enable-machine-outliner -mno-red-zone.

llvm-svn: 315136
2017-10-07 00:16:34 +00:00
..
bindings
cmake Bring r314809 back. 2017-10-04 20:27:01 +00:00
docs llvm-dwarfdump: Add an option to collect debug info quality metrics. 2017-10-06 20:24:34 +00:00
examples Fix broken links to the Itanium CXX ABI 2017-09-12 00:19:11 +00:00
include [MachineOutliner] Disable outlining from LinkOnceODRs by default 2017-10-07 00:16:34 +00:00
lib [MachineOutliner] Disable outlining from LinkOnceODRs by default 2017-10-07 00:16:34 +00:00
projects
resources
runtimes [CMake][runtimes] Use the same configuration for non-target and "default" target 2017-09-08 22:26:50 +00:00
test [MachineOutliner] Disable outlining from LinkOnceODRs by default 2017-10-07 00:16:34 +00:00
tools [llvm-rc] Fix some endianness errors. 2017-10-06 23:21:43 +00:00
unittests Support: Rewrite Windows implementation of sys::fs::rename to be more POSIXy. 2017-10-06 17:14:36 +00:00
utils [lit] Improve tool substitution in lit. 2017-10-06 17:54:46 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt Revert "[CMake] Remove `CMAKE_.*_OUTPUT_DIRECTORY` (NFCI)" 2017-09-29 19:50:41 +00:00
CODE_OWNERS.TXT
CREDITS.TXT Add myself to CREDITS.txt 2017-09-18 14:33:39 +00:00
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.