[NFC] Optionally pass a function to emitInstrCountChangedRemark

In basic block, loop, and function passes, we already have a function that
we can use to emit optimization remarks. We can use that instead of searching
the module for the first suitable function (that is, one that contains at
least one basic block.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341253 91177308-0d34-0410-b5e6-96231b3b80d8
3 files changed