This is an archive of the discontinued LLVM Phabricator instance.

ThinLTO: add module caching handling.
ClosedPublic

Authored by mehdi_amini on Mar 26 2016, 4:45 PM.

Diff Detail

Event Timeline

mehdi_amini retitled this revision from to ThinLTO: add module caching handling..
mehdi_amini added a reviewer: tejohnson.
mehdi_amini added a subscriber: llvm-commits.
mehdi_amini added inline comments.Mar 26 2016, 10:03 PM
lib/LTO/ThinLTOCodeGenerator.cpp
334

Unfortunately this is not enough to handle internalization, or linkonce_odr optimization like in D18346, I'll have to give more thought about it.

mehdi_amini added inline comments.Mar 26 2016, 10:58 PM
lib/LTO/ThinLTOCodeGenerator.cpp
334

Another issue is that promotion will rename later a global with a name that will different between two different links if the object is not in the same position. The hashing here does not account for this unfortunately.
It seems like an intrinsically hard problem to solve (unless we give-up on sharing objects across two different links)

tejohnson added inline comments.Apr 6 2016, 7:47 AM
lib/LTO/ThinLTOCodeGenerator.cpp
334

Unfortunately this is not enough to handle internalization, or linkonce_odr optimization like in D18346, I'll have to give more thought about it.

For the linkonce optimization, how about compute and hash the set of isFirstDefinitionForLinker entries for this module? That is solely based off of summaries.

Update: fix ODR resolution and preserved symbols (for future internalization).

Add compiler revision as part of the hash

tejohnson edited edge metadata.Apr 13 2016, 9:15 AM

Is this essentially done and ready for re-review? (Realize it is dependent on outstanding patch D18987.)

lib/LTO/ThinLTOCodeGenerator.cpp
302–369

Not directly related to this patch, but I just noticed that the CacheOptions parameter here is unused.

No, Not at all, thanks for checking!

mehdi_amini edited edge metadata.

Rebase and update, this one should be good now.

tejohnson accepted this revision.Apr 15 2016, 5:01 PM
tejohnson edited edge metadata.

Couple small comments, but otherwise, I think this looks good.

include/llvm/ADT/StringExtras.h
62

Use doxygen style comment "///"

lib/LTO/ThinLTOCodeGenerator.cpp
197–198

Why this change? D18908 uses a DenseMap.

This revision is now accepted and ready to land.Apr 15 2016, 5:01 PM
mehdi_amini added inline comments.Apr 15 2016, 5:02 PM
lib/LTO/ThinLTOCodeGenerator.cpp
197–198

To compute the hash for the cache, we iterate over the map, so we need a stable ordering.

tejohnson added inline comments.Apr 15 2016, 5:06 PM
lib/LTO/ThinLTOCodeGenerator.cpp
197–198

Ah, ok. Probably worth a comment.

mehdi_amini marked 7 inline comments as done.
mehdi_amini edited edge metadata.

Address comments (add a comment for the std::map)