This is an archive of the discontinued LLVM Phabricator instance.

IRGen: When loading the main module in the distributed ThinLTO backend, look for the module containing the summary.
ClosedPublic

Authored by pcc on Jan 23 2017, 6:53 PM.

Event Timeline

pcc created this revision.Jan 23 2017, 6:53 PM
mehdi_amini added inline comments.Jan 23 2017, 8:13 PM
clang/include/clang/CodeGen/BackendUtil.h
51

Indentation seems strange?

clang/lib/CodeGen/CodeGenAction.cpp
841

Can you extract this function in a separate patch? I feel the diff could be a lot more contained here.

tejohnson added inline comments.Jan 24 2017, 7:07 AM
clang/lib/CodeGen/BackendUtil.cpp
867

Would it be better to have this in llvm (e.g. in BitcodeReader like getBitcodeModuleList), or do you anticipate that we will never need that functionality within llvm itself?

clang/lib/CodeGen/CodeGenAction.cpp
848

What should happen if we have a multi-module bitcode file but no ThinLTOIndexFile? Right now I think that would error (with or without this patch), right? Do we instead want to compile the non-ThinLTO module, or compile the ThinLTO module without ThinLTO (which is what would happen if you passed a single-module bitcode file to clang without -fthinlto-index).

clang/test/CodeGen/thinlto_backend.ll
26

Are we testing the right thing here? How do we know we have loaded the correct module when passed an empty index file which causes us to drop to non-ThinLTO compilation with -ignore-empty-index-file? Maybe that handling is later, but it isn't clear from this test - can you instead test using an index file that enables ThinLTO compilation?

pcc added inline comments.Jan 24 2017, 12:09 PM
clang/include/clang/CodeGen/BackendUtil.h
51

Yes, it's what clang-format does though.

clang/lib/CodeGen/BackendUtil.cpp
867

Maybe -- at this point I feel that we are shoehorning far too much thinlto backend functionality into clang and that we should think about making it into a separate tool. If we ever create such a tool, we can easily move this function there.

clang/lib/CodeGen/CodeGenAction.cpp
841

Done for this function as well as loadModule in r292970 and r292972.

848

Yes, we'd error out in that case, and I think that's fine. Basically at the moment we only support passing ThinLTO output to either the linker or the thin backend, and anything else is unsupported.

clang/test/CodeGen/thinlto_backend.ll
26

Done, and split out into a separate test.

pcc updated this revision to Diff 85618.Jan 24 2017, 12:09 PM

Address review comments

This revision is now accepted and ready to land.Jan 24 2017, 2:18 PM
This revision was automatically updated to reflect the committed changes.