> > > > But then inlining / cloning is no longer cheap, no? And will be > > disabled at -O2? > > If you declare it "inline" and not "static inline" it will be inlined pretty > much as before, only it will get unified if it ends up out of line in multiple > units. > > Main difference in between static and non-static is in logic deciding when > inlining into all callers will lead to removing the offline copy from the > program. This is controlable by comdat-sharing-probability parameter. > > We won't clone at -O2 unless we know code will shrink that may be something to > revisit. I think it would be resonable to enable clonning at -O2 for > functions > declared inline. > > I was also playing with idea adding a GCC decision to function mangling, so > comdat clones can be inlined. I.e. having something like ^^^^ inlined means unified by the comdat sharing machinery.
Honza > mangled_foo->mangled_foo.__gcc_cprop_clone.arg0_0.arg1_17 It would need to > invent unique textual representations of all/most our substitutions that can > get tricky. > > Honza