This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Avoid running LTO pipeline for no files
ClosedPublic

Authored by keith on Mar 3 2023, 1:28 PM.

Details

Reviewers
int3
Group Reviewers
Restricted Project
Commits
rGa65678b35bbc: [lld-macho] Avoid running LTO pipeline for no files
Summary

If no bitcode files are given as inputs but -object_path_lto is passed
we should avoid running the LTO pipeline.

This mirrors this patch from the ELF port https://github.com/llvm/llvm-project/commit/f3994e4dfa0214b2a09a0e327ba37e6b38bbcdb3

Fixes https://github.com/llvm/llvm-project/issues/61031

Diff Detail

Event Timeline

keith created this revision.Mar 3 2023, 1:28 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 3 2023, 1:28 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
keith requested review of this revision.Mar 3 2023, 1:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 1:28 PM
int3 accepted this revision.Mar 3 2023, 1:40 PM
int3 added a subscriber: int3.

Thanks!! I think we should follow LLD-ELF whenever reasonable/possible, so I like this better

lld/MachO/Driver.cpp
556 ↗(On Diff #502246)

personally I think it's nicer to have hasFiles be a member of BitcodeCompiler and have it set by BitcodeCompiler::add() -- in principle the BitcodeCompiler should already know if it has any files, we shouldn't need to tell it twice

lld/test/MachO/lto-object-path.ll
42–44

ultra nit: "NOOBJPATH" refers to the fact that we are not passing -object_path_lto, but "NOLTOPATH" here means we are not passing in any paths to LTO files... the similarity in names seems kind of misleading. Maybe "NOLTOFILES" would be better?

This revision is now accepted and ready to land.Mar 3 2023, 1:40 PM
keith updated this revision to Diff 502254.Mar 3 2023, 1:56 PM
keith marked 2 inline comments as done.

Move bool into BitcodeCompiler

keith updated this revision to Diff 502255.Mar 3 2023, 2:00 PM

spacing

This revision was automatically updated to reflect the committed changes.