Commit Graph

3 Commits

Author SHA1 Message Date
Hamish Knight
5a8c14d583 [Profiler] Fix up a couple uses of emitProfilerIncrement
Remove a case where we know we don't have a
profiler, and avoid incrementing for a distributed
factory method. Otherwise such cases could pass
a null ASTNode, which will become an assertion
failure in a future commit.

While we're here, let's standardize on emitting
the profiler increment for function entry after
the prolog, as if there's e.g an unreachable
parameter, the increment can be safely elided
anyway.
2022-10-13 19:42:36 +01:00
Hamish Knight
b12015c343 [SIL] Introduce the increment_profiler_counter instruction
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
2022-09-07 17:55:13 +01:00
Vedant Kumar
ab817e83e0 [Profiler] Increment function body count prior to the prolog
This fixes another 'SILBuilder has no valid insertion point' assertion
failure seen when compiling Carthage.

rdar://68759819
2020-09-15 11:09:24 -07:00