Commit Graph

6 Commits

Author SHA1 Message Date
Hamish Knight
64fcbd9412 [Profiler] Support lazy variable initializers
Start visiting LazyInitializerExpr for profiling,
such that we emit a profile counter when
initializing the initial value for the first time.

rdar://43393937
2022-08-19 14:03:40 +01:00
Hamish Knight
19e1e2f7a2 [SILGen] Fix deinit coverage mapping
Stop profiling the deallocating deinitializer
function for non-ObjC classes, and instead profile
the destructor, which is where we emit the user's
code written in a `deinit`.

rdar://54443107
2022-08-11 15:09:53 +01:00
Slava Pestov
45330816b4 Profile: Run tests through to -emit-ir to get better coverage 2020-03-17 19:03:03 -04:00
Vedant Kumar
569c8afc54 [Profiler] Separate profiler instances for property inits and constructors (#25247)
Assign separate SILProfiler instances to stored property initializers
and constructors.

Starting with rdar://39460313, coverage reporting for these constructs
was bundled up into a single SILProfiler uniqued by the NominalTypeDecl.
There are two problems with doing this.

First, the shared SILProfiler is given a fake name that can't be
demangled. That breaks Xcode's reports.  Second, the relationship
between SILProfiler and SILFunction is supposed to be 1:1. Having a
shared SILProfiler muddies things a bit and requires extra bookkeeping.

rdar://47467864
2019-06-05 10:38:10 -07:00
Vedant Kumar
6d467fd31f [SILProfiler] Don't crash when coverage info for lazy getters is incomplete (#18744)
ASTWalker visits a lazy_initializer_expr once within its associated
var_decl (by way of the parent nominal type). However, SILGen visits the
lazy_initializer_expr while inside of the var_decl's getter. The result
is that there is no coverage mapping information for the contents of the
lazy init within the getter's SILProfiler.

Fixing this will require reworking how profile counters are assigned to
be more in line with what SILGen needs.

As a stop-gap, this patch prevents SILGen from asserting that coverage
mappings are complete with a defensive check which prevents a crash seen
in SR-8429.

rdar://42792053
2018-08-15 17:48:21 -07:00
Vedant Kumar
c3f4d99e57 Group the the code coverage, profiling, and pgo tests together (#16070)
* Group tests for profiling instrumentation together, NFC

This will make it easier to test changes to the code coverage logic.

There are a handful of tests which relate to profiling which I have not
moved. These include tests for the driver and for the SIL optimizer. It
makes more sense to keep those tests where they are.

* Rename a test file, NFC

This file tests code coverage of primary files, so I've changed the name
of the file to reflect that.

* Simplify the check lines in a test, NFC

This file tests code coverage of closures. It had several check lines
which obscured the meaning of the test, and its check lines were in a
strange order.

Remove the extra checks and disable -emit-sorted-sil.
2018-04-20 15:15:52 -07:00