This is an archive of the discontinued LLVM Phabricator instance.

fix a crash in MergeFunctions related to ordering of weak/strong functions
ClosedPublic

Authored by eeckstein on May 13 2016, 10:42 AM.

Details

Summary

The assumption, made in insert() that weak functions are always inserted after strong functions, is only true in the first round of adding functions. In subsequent rounds this is no longer guaranteed , because we might remove a strong function from the tree (because it's modifier) and add it later, where a equivalent weak function already exists in the tree.
This change removes the assert in insert() and explicitly enforces a weak->strong order.
This also removes the need of two separate loops in runOnModule().

Diff Detail

Event Timeline

eeckstein updated this revision to Diff 57213.May 13 2016, 10:42 AM
eeckstein retitled this revision from to fix a crash in MergeFunctions related to ordering of weak/strong functions.
eeckstein updated this object.
eeckstein added reviewers: nicholas, jfb, dyatkovskiy, sanjoy.
eeckstein added a subscriber: llvm-commits.
eeckstein updated this revision to Diff 57220.May 13 2016, 10:45 AM

forgot to add the test file

nicholas accepted this revision.May 29 2016, 12:11 AM
nicholas edited edge metadata.
This revision is now accepted and ready to land.May 29 2016, 12:11 AM

Thanks for reviewing!
Committed in r271299