[PATCH] D108581: [CSPGO] Fix lost IRPGOFlag in CSPGO instrumentation

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 23 16:09:16 PDT 2021


MaskRay added inline comments.


================
Comment at: llvm/lib/ProfileData/InstrProf.cpp:1104
 
+  // For CSPGO, this variable might be marked as non-prevailing and we only
+  // have the decl.
----------------



================
Comment at: llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp:468
     createProfileFileNameVar(M, InstrProfileOutput);
-    createIRLevelProfileFlagVar(M, /* IsCS */ true, PGOInstrumentEntry);
+    appendToCompilerUsed(
+        M, createIRLevelProfileFlagVar(M, /* IsCS */ true, PGOInstrumentEntry));
----------------
Add a comment like:

The variable in a comdat may be discarded by LTO. Ensure the declaration will be retained.

This raises the question: Is llvm.compiler.used allowed to reference a declaration (previously a non-prevailing definition due to comdat selection)? ISTM this should be allowed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108581/new/

https://reviews.llvm.org/D108581



More information about the llvm-commits mailing list