The IRPGOFlag symbol (__llvm_profile_raw_version) is dropped when
identified as non-prevailing for either regular or thin LTO during
the mixed-LTO mode compilation. This happens in the module
where IRPGOFlag is marked as non-prevailing. This variable
is emitted in the final object from the prevailing module.
This is still problematic because we currently query this symbol to coordinate
some actions between PGOInstrumentation pass and InstrProfiling lowering
pass, like whether to do value profiling, weather to do comdat renaming.
TThis problem is bought up by YolandaCY in
https://reviews.llvm.org/D107034
YolandCY reported unresolved symbol linker errors in CSPGO instrumentation build.
D107034 proposed to set a module flag as the fix.
But I think a better way is to let LTO retain IRPGOFlag decl by adding
it to CompilerUsed list and relax the check in isIRPGOFlagSet() when
doing the InstruProfling lowering.
The test case in the patch is from D107034.