PGO: don't emit counter increment if no counters have been allocated.

I hit this while debugging another issue where my sources were in an
inconsistent state, so I don't have a testcase. Regardless, this check is
simpler and more direct than checking if the option is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203072 91177308-0d34-0410-b5e6-96231b3b80d8
Refactor PGO code in preparation for handling non-C/C++ code.

Move the PGO.assignRegionCounters() call out of StartFunction, because that
function is called from many places where it does not make sense to do PGO
instrumentation (e.g., compiler-generated helper functions). Change several
functions to take a StringRef argument for the unique name associated with
a function, so that the name can be set differently for things like Objective-C
methods and block literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203073 91177308-0d34-0410-b5e6-96231b3b80d8
PGO: Rename variables to avoid referring to the "MangledName" of a function.

For C++ functions, we will continue to use the mangled name to identify
functions in the PGO profile data, but this name is confusing for things like
Objective-C methods. For functions with local linkage, we're also going to
include the file name to help distinguish those functions, so this changes to
use more generic variable names.

No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203074 91177308-0d34-0410-b5e6-96231b3b80d8
PGO: Use the main file name to help distinguish functions with local linkage.

In addition, for all functions, use the name from the llvm::Function to
identify the function in the profile data. Compute that "function name",
including the file name for local functions, once when assigning the PGO
counters and store it in the CodeGenPGO class.

Move the code to add InlineHint and Cold attributes out of StartFunction(),
because the "function name" string isn't available at that point.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203075 91177308-0d34-0410-b5e6-96231b3b80d8