[PATCH] D36440: [ThinLTO] Fix thinLTO crash

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 22:46:16 PDT 2017

davidxl added a comment.

got time to look at it more.  The root cause of why the call resolves to a static variable in another module is from the following code in BitcodeWriter.cpp.   The call to ::link was recorded to GUID: 14802282251123568682 which was correct. Since it does not have a value-id, the logic for sample PGO kicks in. 14802282251123568682 was treated as 'original guid' and the from the map, the PGO annotated GUID for the static var was found (note that one original guid maps to multiple GUIDs).  After this, the call to :link now resolves to static var 'link's GUID.

3612│     for (auto &EI : FS->calls()) {
3613│       // If this GUID doesn't have a value id, it doesn't have a function
3614│       // summary and we don't need to record any calls to it.
3615│       GlobalValue::GUID GUID = EI.first.getGUID();
3616├>      auto CallValueId = getValueId(GUID);
3617│       if (!CallValueId) {
3618│         // For SamplePGO, the indirect call targets for local functions will
3619│         // have its original name annotated in profile. We try to find the
3620│         // corresponding PGOFuncName as the GUID.
3621│         GUID = Index.getGUIDFromOriginalID(GUID);


More information about the llvm-commits mailing list