Commit Graph

27 Commits

Author SHA1 Message Date
Hamish Knight
5e348c2161 [Profiler] Simplify CounterExpr
This class is more or less just duplicating LLVM's
`Counter` class, as such we can just wrap it
directly and avoid having to construct it later.
This is a tentative fix for rdar://118185163 since
it eliminates the code in question, though I still
want to investigate that issue further.
2023-11-16 17:28:58 +00:00
Hamish Knight
d31f76853a [SIL] Introduce skipped coverage ranges
Introduce a skipped region kind, printed using
a `skipped` keyword.
2023-11-14 20:41:35 +00:00
Hamish Knight
d59ff45468 [Profiler] Track the parent SourceFile for a SILCoverageMap
This tracks the source file that the profiled
entity was defined in.
2022-12-06 14:28:34 +00:00
Vedant Kumar
9606717bae [Coverage] Drop records for functions DCE'd after builtin lowering
A function may be eliminated as dead code after initial builtin lowering
occurs. When this happens, an entry in the profile symbol table for the
function is not guaranteed. Its coverage record should be dropped.

rdar://42564768
2019-08-23 18:55:31 -07:00
Bob Wilson
9dc02e67a2 master-next: Stop using ilist_default_traits
LLVM r330736 removed ilist_default_traits. Apparently it is not needed
and ilist_node_traits works just as well.
2018-04-25 22:44:58 -07:00
Sho Ikeda
03fbd4a6de [gardening][SIL] Replace typedef with using 2018-04-05 13:53:20 +09:00
Vedant Kumar
6debe84674 [Coverage] Record PGO function name in SILCoverageMap
This simplifies the lowering of instrprof_increment by getting rid of a
call to llvm::getPGOFuncName().
2018-01-05 17:20:20 -08:00
Vedant Kumar
54f3754337 [Coverage] Clean up a few classes, NFC
Run clang-format, delete some dead code, and fix a few naming
inconsistencies.
2018-01-05 17:20:20 -08:00
Vedant Kumar
dd560d2aa6 [Coverage] Refactor SIL generation for profiling
This patch moves the ownership of profiling state from SILGenProfiling
to SILFunction, where it always belonged. Similarly, it moves ownership
of the profile reader from SILGenModule to SILModule.

The refactor sets us up to fix a few outstanding code coverage bugs and
does away with sad hacks like ProfilerRAII. It also allows us to locally
guarantee that a profile counter increment actually corresponds to the
SILFunction at hand.

That local guarantee causes a bugfix to accidentally fall out of this
refactor: we now set up the profiling state for delayed functions
correctly. Previously, we would set up a ProfilerRAII for the delayed
function, but its counter increment would never be emitted :(. This fix
constitutes the only functional change in this patch -- the rest is NFC.

As a follow-up, I plan on removing some dead code in the profiling
logic and fixing a few naming inconsistencies. I've left that for later
to keep this patch simple.
2018-01-05 17:20:20 -08:00
Vedant Kumar
cccee1df03 Revert "[Coverage] Refactor SIL generation for profiling" 2018-01-03 21:57:49 -08:00
Mark Lacey
7c49bc9733 Revert "[Coverage] Clean up a few classes, NFC" 2018-01-03 18:51:28 -08:00
Vedant Kumar
e875efa4ae [Coverage] Clean up a few classes, NFC
Run clang-format, delete some dead code, and fix a few naming
inconsistencies.
2018-01-03 16:46:18 -08:00
Vedant Kumar
aba9d53736 [Coverage] Refactor SIL generation for profiling
This patch moves the ownership of profiling state from SILGenProfiling
to SILFunction, where it always belonged. Similarly, it moves ownership
of the profile reader from SILGenModule to SILModule.

The refactor sets us up to fix a few outstanding code coverage bugs and
does away with sad hacks like ProfilerRAII. It also allows us to locally
guarantee that a profile counter increment actually corresponds to the
SILFunction at hand.

That local guarantee causes a bugfix to accidentally fall out of this
refactor: we now set up the profiling state for delayed functions
correctly. Previously, we would set up a ProfilerRAII for the delayed
function, but its counter increment would never be emitted :(. This fix
constitutes the only functional change in this patch -- the rest is NFC.

As a follow-up, I plan on removing some dead code in the profiling
logic and fixing a few naming inconsistencies. I've left that for later
to keep this patch simple.
2018-01-03 11:18:40 -08:00
Huon Wilson
92e9d2d84f [SIL] Extract reoccuring allocation patterns.
No need to write a pile of manual memcpy's.
2017-01-26 12:42:13 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Bob Wilson
2c21ef586d Update to match llvm r279473: remove ilist_*sentinel_traits.
(cherry picked from commit 391e7d8b60)
2016-12-01 10:46:38 -08:00
Bob Wilson
26a62b912a Update to match llvm r278513: share code for embedded sentinel traits.
Nothing at all should be changing here, this is just rearranging code.

(cherry picked from commit 9964697f22)
2016-12-01 10:42:59 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Mark Lacey
4dbf8d70dd Fixes for moved LLVM header files
The latest merge brought in changes that move some LLVM header
files.
2016-05-03 17:00:22 -07:00
Erik Eckstein
8f78085e8b Refactor SILPrinter.
Introduce a new SILPrintContext class which is the main handle passed to the SILModule's and SILFunction's print functions.
It also allows to let derived classes implement call backs on instruction printing.
NFC for now, but needed for the upcoming SIL-debuginfo change.
2016-03-18 14:01:38 -07:00
Vedant Kumar
dc11f8bf01 [Coverage] Re-apply "Respect function linkage in PGO name variables"
Fix a crash in emitBuiltinCall() which occurs because we drop function
linkage information when creating SILCoverageMaps.

This re-applies 45c7e4e86 with the MachO-specific checks in the test
case removed.
2016-03-17 22:44:35 -07:00
Vedant Kumar
c59b266f93 Revert "[Coverage] Respect function linkage in PGO name variables"
This reverts commit 45c7e4e861.

The IR CHECK lines in coverage.swift are flaky.
2016-03-17 18:21:32 -07:00
Vedant Kumar
45c7e4e861 [Coverage] Respect function linkage in PGO name variables
Fix a crash in emitBuiltinCall() which occurs because we drop function
linkage information when creating SILCoverageMaps.
2016-03-17 18:06:39 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Justin Bogner
322005d027 InstrProf: Track the filename in coverage maps
If multiple swift files are compiled together, then guessing as to the
file when we emit IR obviously doesn't work. Find the filename when we
generate a function's coverage map and propagate it through SIL.

Swift SVN r25436
2015-02-20 21:26:20 +00:00
Justin Bogner
3dbd6ea9bd InstrProf: SILFunction doesn't live long enough for SILCoverageMap
Keeping a reference to the function here is dangerous. We only
actually care about the name, so save ourselves a copy of that
instead.

This fixes a crash that seems to happen only when the coverage data is
very large.

Swift SVN r25433
2015-02-20 19:36:33 +00:00
Justin Bogner
59bb06b0fb InstrProf: SIL-level coverage mapping and lowering to LLVM
The adds the sil_coveragemap construct to SIL and the needed IRGen to
turn these into LLVM's coverage maps.

Swift SVN r25210
2015-02-12 00:28:39 +00:00