================
@@ -1472,6 +1473,9 @@ 
PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
   const bool LTOPreLink = isLTOPreLink(LTOPhase);
   ModulePassManager MPM;
 
+  // Process copyright metadata early, before any optimizations
----------------
tonykuttai wrote:

The design rationale was to get an IR pass to replace the metadata with an IR 
definition and create the necessary `.ref`s in the IR from the definitions in 
the IR. Thus, the metadata only survives from the point of the front-end 
codegen until that IR pass. Basically we want the follwoing:

- Clang frontend emits `!comment_string.loadtime` metadata (survives only until 
the IR pass)
- `LowerCommentStringPass` runs early in the per-TU pipeline, converts the 
metadata into a concrete `@__loadtime_comment_str` global and attaches 
`!implicit.ref` to all defined functions
- backend reads `!implicit.ref` and emits `.ref` directives into the object file
- By the time LTO runs, the metadata is already consumed and concrete globals + 
`.ref` directives are already in the object file.

https://github.com/llvm/llvm-project/pull/178184
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to