Open Bug 1517350 Opened 5 years ago Updated 2 years ago

-flifetime-dse=1 caused GCC LTO+PGO builds to not read profile feedback correctly

Categories

(Firefox Build System :: Toolchains, enhancement)

64 Branch
enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: jh, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0

Steps to reproduce:

Built Firefox with GCC 8 and GCC 9 with LTO+PGO


Actual results:

I got tons of -Wcoverage-mismatch warings (1300 of them) like:
/aux/hubicka/firefox-2018/release/mfbt/double-conversion/double-conversion/bignum.cc:161:6: warning: the control flow of function ‘double_conversion::Bignum::AddUInt64(unsigned long)’ does not match its profile data (counter ‘arcs’) [-Wcoverage-mismatch]

This means that GCC discarded profile for this function because at profile instrumentation time it differed between -fprofile-generate and -fprofile-use copilation. The reason is that LTO+PGO build is now configured to disable LTO for -fprofile-generate. However with -flto also -flifetime-dse=1 is enabled to work around some Firefox bugs which reproduced with GCC 6+ (Clang still seems to not optimize here as aggressively). This makes optimization diverge before profile instrumentation in those functions and causes loss of profile.

Source files and optimization options should match between -fprofile-generate and -fprofile-use builds. It also does not make sense to use -flifetime-dse=1 only for LTO builds - if there are bugs they are probably affecting non-LTO builds as well.

I am going to try if I can reproduce any crash with GCC 8 and 9 with -flifetime-dse=1 dropped.


Expected results:

It should have worked.
Blocks: build-gcc-8
Component: Untriaged → General
Product: Firefox → Firefox Build System
Keywords: in-triage
Severity: normal → enhancement
Component: General → Toolchains
Keywords: in-triage
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.