[PATCH] D19096: ModuleLinker: do not always pull-in linkonce_odr when performing ThinLTO importing

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 17:07:23 PDT 2016


joker.eph added inline comments.

================
Comment at: test/ThinLTO/X86/odr_resolution.ll:13
@@ -12,3 +12,3 @@
 
 ; Alias are not optimized
 ; MOD1: @linkoncealias = linkonce_odr alias void (), void ()* @linkonceodrfuncwithalias
----------------
tejohnson wrote:
> Can you remind me how we prevent the alias from being optimized this way? We have AliasSummary in DefinedGlobals, but only the aliasee are added to the GlobalInvolvedWithAlias set. I don't see where it is preventing the ODR resolution for the alias itself. If we did try to do the alias resolution, we would end up with an available_externally alias in MOD2, which is illegal.
> 
> If we do in fact prevent the ODR resolution in this case, then I think there is a different issue. If we have a reference to the alias in an imported routine, with the change to addLazyFor() we would no longer import this linkonce alias as a definition, and the IRMover will convert the imported declaration to ExternalWeak. But with all the copies of the defintion remaining linkonce, we aren't guaranteed to emit a copy anywhere, they could all be eliminated after inlining in their original modules, and we have an undef at link time.
Yes, it is done late in `fixupODR()` does not iterate over aliases in `ThinLTOCodeGenerator`, and yeah it is bad...
I'll write a test case with a `linkonce_odr alias`



http://reviews.llvm.org/D19096





More information about the llvm-commits mailing list