[PATCH] D18298: ThinLTO: do not promote GlobalVariable that have a specific section.
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 09:11:47 PDT 2016
tejohnson added a comment.
In http://reviews.llvm.org/D18298#408779, @joker.eph wrote:
> I'm hitting a wall: even with adding the "hasSection" flag to the summary: no renaming a function breaks the model.
>
> Module A {
> define internal foo() { ... };
> define bar() { foobar() };
> }
>
> Module B {
> define foo() { ... };
> define foobar() { foo() };
> }
>
>
> If we leave `internal foo()` internal in module A and we don't rename it, we have a problem when we want to import `foobar()` because of the collision on the call to `foo()` in module B.
> There is nothing in the index that can help to address this situation. We reach a point were the only conservative strategy I can imagine is to detect the collision "late" (i.e. during the FunctionImporter, in the "backend" job) and do not perform the import.
> This is annoying because it prevents future optimizations (like "moving" a global for instance).
How frequent/important are the modules where specific sections are used? Another conservative possibility is to simply prevent importing into any module that contains a GV with local linkage and the hasSection flag set (which is info available in the index).
Also, I assume the plan is to use the proposed hasSection flag to prevent importing any function containing a reference to a local with that flag set (to avoid introducing a cross-module reference requiring promotion). If renaming is ok, but not the promotion, then a local function with hasSection can itself be imported, if we keep the imported copy local (in which case functions containing references to it can also be imported).
http://reviews.llvm.org/D18298
More information about the llvm-commits
mailing list