This is an archive of the discontinued LLVM Phabricator instance.

[LTO] Simplify APIs and constify (NFC)
ClosedPublic

Authored by mehdi_amini on Aug 15 2016, 5:53 PM.

Details

Summary

Multiple APIs were taking a StringMap for the ImportLists containing
the entries for for all the modules while operating on a single entry
for the current module. Instead we can pass the desired ModuleImport
directly. Also some of the APIs were not const, I believe just to be
able to use operator[] on the StringMap.

Diff Detail

Repository
rL LLVM

Event Timeline

mehdi_amini retitled this revision from to [LTO] Simplify APIs and constify (NFC).
mehdi_amini updated this object.
mehdi_amini added a reviewer: tejohnson.
mehdi_amini added a subscriber: llvm-commits.
tejohnson accepted this revision.Aug 15 2016, 9:29 PM
tejohnson edited edge metadata.

LGTM, thanks. A nit and a comment below.

include/llvm/Transforms/IPO/FunctionImport.h
117 ↗(On Diff #68117)

Suggest making the argument name here and in EmitImportsFiles "ImportList" to be consistent with some of the other places where a single module's import list is passed.

lib/Transforms/IPO/FunctionImport.cpp
449 ↗(On Diff #68117)

There's a behavior difference here in that we used to check here and in EmitImportsFiles whether the path was in the map, but with the new handling we will construct a default entry if it wasn't in the map when we do ImportLists[ModulePath]. I don't think this is a big deal though.

This revision is now accepted and ready to land.Aug 15 2016, 9:29 PM
This revision was automatically updated to reflect the committed changes.
mehdi_amini added inline comments.Aug 15 2016, 10:57 PM
include/llvm/Transforms/IPO/FunctionImport.h
117 ↗(On Diff #68117)

Done.
I also separately committed a renaming in all FunctionImport.cpp where ImportListsForModule was used multiple times (I initially took it from there).