This is a dedicated instruction for incrementing a
profiler counter, which lowers to the
`llvm.instrprof.increment` intrinsic. This
replaces the builtin instruction that was
previously used, and ensures that its arguments
are statically known. This ensures that SIL
optimization passes do not invalidate the
instruction, fixing some code coverage cases in
`-O`.
rdar://39146527
Previously we assumed the exit counter was the
same as the entry counter. Update the logic such
that we track break statements (including
implicitly at the end of a case), as well as
early returns and jumps to parent statements. This
follows a similar logic to what we do for if
statements.
rdar://99141044
* 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.