Currently, the --thinlto-suffix-replace="oldsuffix;newsuffix" option
is used during distributed ThinLTO thin links to specify the mapping
of the input bitcode object file to the minimized bitcode file.
--thinlto-suffix-replace is the only option specifying the mapping
between those files.
This forces the full bitcode file and the minimized bitcode file to be in
the same directory.
This patch expands the --thinlto-prefix-replace option to allow a
separate directory tree mapping to be specified for the minimized
bitcode file paths.
This is important to support builds and build systems where a directory
that is the output of a single action must either be fully included or
not included as the input of another action (e.g. the thin link, it must take as its input
the minimized bitcode files but not take as input the full bitcode files).
The new format is: --thinlto-prefix-replace="origpath;outpath[;objpath][;minimizedbitcodepath]"
If minimizedbitcodepath is specified it replaces minimizedbitcodepath
of the minimized bitcode files with origpath when mapping the minimized
bitcode to the full bitcode, otherwise it falls back to the old behavior of
assuming both files are in the same directory. The rewritten path is written
into the index and imports files for the subsequent distributed ThinLTO backends.
With this change instead of mapping the minimized bitcode to the full
bitcode using a suffix replace, we can instead use a prefix replace.
This should be thinLTOPrefixReplaceMinimizedBitcode not thinLTOPrefixReplaceMinimizedIndex to match the code (and MinimizedBitcode is a better name IMO).
I also think with this change that we should rename thinLTOPrefixReplaceOld to thinLTOPrefixReplaceFullBitcode, and thinLTOPrefixReplaceNew with thinLTOPrefixReplaceOutputFile or something similar, to clarify what each of these paths are.
Then I suggest making the comment something like "replace the prefix of the minimized thin link input bitcode files, thinLTOPrefixReplaceMinimizedBitcode, with thinLTOPrefixReplaceFullBitcode, when the bitcode path is written to output index and imports files, allowing..."