This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Do not assert when adding a module with a different but compatible target triple
ClosedPublic

Authored by ahatanak on May 17 2017, 11:00 AM.

Details

Summary

Currently, an assertion fails in ThinLTOCodeGenerator::addModule when the target triple of the module being added doesn't match that of the one stored in TMBuilder. This patch relaxes the constraint and makes changes to allow target triples that only differ in their version numbers on Apple platforms, similarly to what r228999 did.

Note that this patch only checks whether the target triples of the modules are compatible, but doesn't do anything to change the target triple in the IR when different but compatible triples are seen. Should we overwrite the triples in the IR so that they are identical to the one in TargetMachine? If the answer is yes, where or when should that happen?

rdar://problem/30133904

Diff Detail

Repository
rL LLVM

Event Timeline

ahatanak created this revision.May 17 2017, 11:00 AM
mehdi_amini accepted this revision.May 17 2017, 12:14 PM

LGTM. See one inline comment.

include/llvm/ADT/Triple.h
730 ↗(On Diff #99328)

match isn't very clear to me, I wouldn't know the difference between "match" and "equal", do you have a better name?
I'd suggest isCompatibleWith or something like this.

This revision is now accepted and ready to land.May 17 2017, 12:14 PM
ahatanak updated this revision to Diff 99373.May 17 2017, 5:19 PM
ahatanak marked an inline comment as done.

Renamed function to isCompatibleWith. Also, added FileChecks to the test case.

This revision was automatically updated to reflect the committed changes.