This is an archive of the discontinued LLVM Phabricator instance.

Refactor how we decide which sections to sort
ClosedPublic

Authored by espindola on Feb 8 2018, 4:47 PM.

Details

Reviewers
ruiu
Bigcheese
Summary

This is a bit more verbose, but it has a few advantages.

The logic on what to do with special sections like .init_array is not duplicated. Before we would need keep isKnownNonreorderableSection in sync.

I think with this the call graph based sorting can be implemented by "just" returning a new order from buildSectionOrder.

Diff Detail

Event Timeline

espindola created this revision.Feb 8 2018, 4:47 PM
ruiu accepted this revision.Feb 8 2018, 5:33 PM

LGTM

I like the new code. That's slightly verbose but much easier to read.

This revision is now accepted and ready to land.Feb 8 2018, 5:33 PM
Bigcheese accepted this revision.Feb 8 2018, 5:47 PM

Seems fine and removes the duplication of names. My only concern is mixing --symbol-ordering-file with call graph sort in buildSectionOrder. Currently in the patch call graph sorting is applied then the order file. With this the two would need to be mixed into a single DenseMap, or the loop would need to be duplicated (which is what the patch currently does).