This is an archive of the discontinued LLVM Phabricator instance.

Add a llvm::shuffle and use it in lld
ClosedPublic

Authored by respindola on Feb 21 2020, 9:05 AM.

Details

Summary

With this --shuffle-sections=seed produces the same result in every
host.

Event Timeline

respindola created this revision.Feb 21 2020, 9:05 AM
MaskRay added inline comments.Feb 21 2020, 10:25 AM
lld/test/ELF/shuffle-sections.s
9

Also delete mention of std::shuffle in shuffle-sections-init-fini.s

I think keeping ORDERED-SAME and SHUFFLED-NOT in shuffle-sections-init-fini.s as is is fine, though I will not object if you also change them to test a particular order.

llvm/include/llvm/ADT/STLExtras.h
1014

Return if first == last

1015

< -> !=

1018

d can be inlined.

MaskRay added inline comments.Feb 21 2020, 10:29 AM
llvm/include/llvm/ADT/STLExtras.h
1010

Based on the libc++ implementation. llvm -> LLVM

Update all tests
Simplify the implementation a bit. This is not exactly what was requested, but IMHO it is simpler.

respindola marked an inline comment as done.Feb 21 2020, 3:04 PM
respindola marked an inline comment as done.
respindola marked an inline comment as done.
MaskRay accepted this revision.Feb 21 2020, 4:44 PM
MaskRay added inline comments.
llvm/include/llvm/ADT/STLExtras.h
1017

i can be inlined, too.

This revision is now accepted and ready to land.Feb 21 2020, 4:44 PM
grimar accepted this revision.Feb 22 2020, 2:50 AM

LGTM with minor nits.

llvm/include/llvm/ADT/STLExtras.h
1013

This file seems has inconsistent variables naming style, but seems
everything that goes below "Extra additions for arrays" uses
an upper case for variable names.

1017

Also we often trying to avoid auto when the result in not obvious.
(here and above).

MaskRay updated this revision to Diff 246081.Feb 22 2020, 10:03 AM
MaskRay edited the summary of this revision. (Show Details)

Protect against comma operator overload.

Simplify

This revision was automatically updated to reflect the committed changes.