Am 31.10.24 um 19:18 schrieb Jakub Jelinek:
On Thu, Oct 31, 2024 at 07:14:08PM +0100, Kilian Hanich via devel wrote:
While we are at it, please don't mix -O2 and -O3 while compiling the
same program.
This can break things and is really not fun to debug (and that's also
the reason why a lot of buildsystems don't support that).
It works just fine, one can actually do it even in a single file, this
function is -O3, this is -O2, etc.
And effectively PGO is all about that, this function or basic block is
hot, more optimization which could increase size and likely improve
performance are done on it, this is cold, do other optimizations on it.
Jakub
Technically yes, but as somebody in this thread stated, -O3 sometimes
manages to break programs which were relying on UB. Mixing -02 and -03
does this considerably more often.
From my experience you also run surprisingly often into compiler bugs
(likely because that's rarely done since, as I already stated, most
build systems don't support mixing). One case where this happens is
especially with templates in header files because this can create
different instantiations of it even they should be the same.
But PGO has these bugs less often as I noticed myself. I don't know why,
but my guess would be because the compiler gets information about the
whole program instead of just parts (the current C or C++ file).
Either way it should be interesting to see how this will be with C++
modules because these really dislike changing compiler options even
slightly (after all, the idea is that compilers can just mmap these
without parsing; at least as far as I know).
Regards
Kilian Hanich
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue