[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
This commit is contained in:
Vedant Kumar
2020-09-15 11:07:48 -07:00
parent 6d3ee1aae3
commit ab817e83e0
2 changed files with 15 additions and 1 deletions

View File

@@ -506,11 +506,11 @@ void SILGenFunction::emitFunction(FuncDecl *fd) {
MagicFunctionName = SILGenModule::getMagicFunctionName(fd);
auto captureInfo = SGM.M.Types.getLoweredLocalCaptures(SILDeclRef(fd));
emitProfilerIncrement(fd->getTypecheckedBody());
emitProlog(captureInfo, fd->getParameters(), fd->getImplicitSelfDecl(), fd,
fd->getResultInterfaceType(), fd->hasThrows(), fd->getThrowsLoc());
prepareEpilog(true, fd->hasThrows(), CleanupLocation(fd));
emitProfilerIncrement(fd->getTypecheckedBody());
emitStmt(fd->getTypecheckedBody());
emitEpilog(fd);