hanchenye-llvm-project/llvm
Daniel Sanders e1414d1760 Annotate timeline in Instruments with passes and other timed regions.
Summary:
Instruments is a useful tool for finding performance issues in LLVM but it can
be difficult to identify regions of interest on the timeline that we can use
to filter the profiler or allocations instrument. Xcode 10 and the latest
macOS/iOS/etc. added support for the os_signpost() API which allows us to
annotate the timeline with information that's meaningful to LLVM.

This patch causes timer start and end events to emit signposts. When used with
-time-passes, this causes the passes to be annotated on the Instruments timeline.
In addition to visually showing the duration of passes on the timeline, it also
allows us to filter the profile and allocations instrument down to an individual
pass allowing us to find the issues within that pass without being drowned out
by the noise from other parts of the compiler.

Using this in conjunction with the Time Profiler (in high frequency mode) and
the Allocations instrument is how I found the SparseBitVector that should have
been a BitVector and the DenseMap that could be replaced by a sorted vector a
couple months ago. I added NamedRegionTimers to TableGen and used the resulting
annotations to identify the slow portions of the Register Info Emitter. Some of
these were placed according to educated guesses while others were placed
according to hot functions from a previous profile. From there I filtered the
profile to a slow portion and the aforementioned issues stood out in the
profile.

To use this feature enable LLVM_SUPPORT_XCODE_SIGNPOSTS in CMake and run the
compiler under Instruments with -time-passes like so:
  instruments -t 'Time Profiler' bin/llc -time-passes -o - input.ll'
Then open the resulting trace in Instruments.

There was a talk at WWDC 2018 that explained the feature which can be found at
https://developer.apple.com/videos/play/wwdc2018/405/ if you'd like to know
more about it.

Reviewers: bogner

Reviewed By: bogner

Subscribers: jdoerfert, mgorny, kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 354365
2019-02-19 18:18:31 +00:00
..
benchmarks
bindings [bindings/go] Fix building on 32-bit systems (ARM etc.) 2019-02-16 22:33:10 +00:00
cmake Annotate timeline in Instruments with passes and other timed regions. 2019-02-19 18:18:31 +00:00
docs index.rst: Remove bb-chapuni from list of IRC bots 2019-02-19 17:00:34 +00:00
examples Fix compilation of examples after 13680223b9 / r352827 2019-02-01 03:23:42 +00:00
include Annotate timeline in Instruments with passes and other timed regions. 2019-02-19 18:18:31 +00:00
lib Annotate timeline in Instruments with passes and other timed regions. 2019-02-19 18:18:31 +00:00
projects Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
resources
runtimes [CMake] Use variables rather than ":" delimiters 2019-02-16 03:57:35 +00:00
test [X86][SSE] Generalize X86ISD::BLENDI support to more value types 2019-02-19 18:05:42 +00:00
tools [yaml2obj][obj2yaml] - Support SHT_GNU_versym (.gnu.version) section. 2019-02-19 15:29:07 +00:00
unittests GlobalISel: Implement moreElementsVector for bit ops 2019-02-19 16:30:19 +00:00
utils [MC] Make SubtargetFeatureKV only store one FeatureBitset and use an 'unsigned' to hold the value. 2019-02-18 06:46:17 +00:00
.arcconfig
.clang-format
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.gitattributes
.gitignore gitignore: ignore clangd index files. 2019-01-25 14:05:18 +00:00
CMakeLists.txt [CMake] Fix ability to use LLVM_ENABLE_PROJECTS with LLVM_EXTERNAL_PROJECTS 2019-02-14 20:57:17 +00:00
CODE_OWNERS.TXT
CREDITS.TXT Remove a period from CREDITS.TXT (testing email change). NFC 2019-01-19 09:07:38 +00:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in Update structured references to the license to the new license. 2019-01-19 11:30:51 +00:00

README.txt

The LLVM Compiler Infrastructure
================================

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.