[PATCH] D73307: Unique Names for Functions with Internal Linkage

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 21:39:23 PDT 2020


MaskRay added a comment.

In D73307#1932131 <https://reviews.llvm.org/D73307#1932131>, @rnk wrote:

> At a higher level, should this just be an IR pass that clang adds into the pipeline when the flag is set? It should be safe to rename internal functions and give private functions internal linkage. It would be less invasive to clang and have better separation of concerns. As written, this is based on the source filename on the module, which is accessible from IR. The only reason I can think of against this is that the debug info might refer to the function linkage name, but maybe that is calculated later during codegen.


I second this suggestion. `clang/lib/CodeGen/BackendUtil.cpp` `EmitAssemblyHelper::EmitAssemblyWithNewPassManager` ModulePassManager may be a more appropriate place for this feature. There are examples from both sides:

- clang frontend: `#pragma redefine_extname`
- middle end IR->IR: the old pass manager has a feature -frewrite-map-file, which does a similar thing but is implemented as an IR transformation.


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

https://reviews.llvm.org/D73307





More information about the cfe-commits mailing list