[clang] [llvm] [PowerPC][AIX] Support #pragma comment copyright for AIX (PR #178184)
Tony Varghese via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 15 22:17:32 PDT 2026
================
@@ -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
More information about the cfe-commits
mailing list