We met with @mtrofin to discuss the requirements for MLGO. We think that trying to combine -fembed-bitcode
and -ffat-lto-objects
isn’t the right strategy. Even though both of these flags have similar goals, that is embedding IR inside the object file, there are also important differences, specifically at which point in the pipeline do we take the IR. Trying to satisfy all of the different requirements with a single flag is likely going to lead to unnecessary complexity.
Our proposal is to keep -fembed-bitcode
but evolve it better meet the needs of MLGO. The first step would be to drop -fembed-bitcode
from the driver and keep it only as a cc1 flag. That’s going to eliminate a lot of the complexity related to flag filtering. After that, we can start evolving -fembed-bitcode
, implementing changes such as combining .llvmbc
and .llvmcmd
into a single section, support for compression, etc.
Separately, we are also prototyping -ffat-lto-objects
implementation in ⚙ D131618 [WIP][Do NOT review] LLD related changes for -ffat-lto-objects support, although that change is not yet ready for review (it also depends on Unified LTO which hasn’t landed yet).