https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125187

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjames at gcc dot gnu.org

--- Comment #11 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Oliver Schönrock from comment #10)
> Slightly off topic:
> 
> 1. Does that also apply when invoking the driver for "compile and link" in a
> single invocation? ie without `-c`  

Yes.

> 
> 2. Does this mean that if we don't pass -flto=[n] for a single TU that
> optimisation opportunities are left on the table? Or, as seems more likely
> to me, it will actual force the compiler to do the same optimisation work,
> that it already did to produce the object, for a second time:
> 

Yes, as it has no IR, e.g. function bodies are not available when linking is
done.

> -flto[=n]
> ...
> "When the object files are linked together, all the function bodies are read
> from these ELF sections and instantiated as if they had been part of the
> same translation unit. "
> 
> It's already done that for a single TU? => LTO is redundant in this case?

For executables with a single TU, it still uses the LTO machinery but there's
obviously less benefit it can give you. It still benefits from some late passes
for layout.

Reply via email to