Add a statistic to count the number of imported functions. Also, add a
new -print-imports option to emit a trace of imported functions, that
works even for an NDEBUG build.
Note that emitOptimizationRemark does not work for the above printing as
it expects a Function object and DebugLoc, neither of which we will have
particularly when we move to summary-based importing.
Hello Teresa! This debug output is not thread-safe, but it is executed from ThinLTO threads. There's a test, llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp3.ll which relies on this output. Currently that test only uses one thread (-thinlto-threads=1). However when using any other number of threads, the test randomly fails.
I wanted to test other values for -thinlto-threads in D75153, but I cannot. I'd like to land that patch, and would like your advice.
What avenue would you suggest? Add/use a mutex here? Remove the coverage for thinlto_samplepgo_icp3.ll in D75153?