This is an archive of the discontinued LLVM Phabricator instance.

[test] Fix use of 'sort -b' in SimpleLoopUnswitch on NetBSD
ClosedPublic

Authored by mgorny on Dec 1 2018, 12:44 PM.

Details

Summary

Add '-k 1' to 'sort -b' calls in SimpleLoopUnswitch tests, as required
for sort implementation on NetBSD. The '-b' modifier is ineffective
if specified without any key. Per the manpage:

Note that the -b option has no effect unless key fields are specified.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Dec 1 2018, 12:44 PM

What's the sorted text? It will help to get some more context.

It's something along the lines of:

Loop at depth 1 containing: %outer_loop.us37.us125.us176<header>,%outer_loop.split.us40.us128.us179,%outer_latch.us41.us.us<latch><exiting>,%outer_loop.split.split.us.us129.us180,%outer_latch.split.us43.us.us,%outer_latch.split.split.us.us130.us,%outer_loop.split.split.split.us.us.us131.us181,%outer_loop.split.split.split.us.split.us.us.us182,%outer_latch.split.split.split.us.us.us.us,%outer_loop.split.split.split.us.split.us.split.us.us.us183,%outer_loop.split.split.split.us.split.us.split.us.split.us.us,%outer_latch.split.split.split.us.us.split.us.us.us,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.us.us,%inner_loop.us12.us.us.us.us.us,%inner_latch.us20.us.us.us.us.us,%outer_latch.split.split.split.us.us.split.us.split.us.us.us.split.split,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.split.us.us,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.split.us.us.split,%outer_latch.split.split.split.us.us.split.us.split.us.us.us,%outer_latch.split.split.split.us.us.split.us.split.us.us.us.split
    Loop at depth 2 containing: %inner_loop.us12.us.us.us.us.us<header>,%inner_latch.us20.us.us.us.us.us<latch><exiting>
Loop at depth 1 containing: %outer_loop.us37.us125.us176.us190<header>,%outer_loop.split.us40.us128.us179.us193,%outer_latch.us41.us.us.us<latch><exiting>,%outer_loop.split.split.us.us129.us180.us194,%outer_latch.split.us43.us.us.us,%outer_latch.split.split.us.us130.us.us,%outer_loop.split.split.split.us.us.us131.us181.us195,%outer_loop.split.split.split.us.split.us.us.us182.us196,%outer_latch.split.split.split.us.us.us.us.us,%outer_loop.split.split.split.us.split.us.split.us.us.us183.us197,%outer_loop.split.split.split.us.split.us.split.us.split.us.us.us198,%outer_latch.split.split.split.us.us.split.us.us.us.us,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.us.us.us199,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.split.us.us.us,%outer_latch.split.split.split.us.us.split.us.split.us.us.us.us,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.split.us.us.split.us.us,%inner_loop.us12.us.us.us.us.us.us.us,%case4.us15.us.us.us.us.us.us.us,%inner_latch.us20.us.us.us.us.us.us.us,%outer_latch.split.split.split.us.us.split.us.split.us.us.us.split.us.us
    Loop at depth 2 containing: %inner_loop.us12.us.us.us.us.us.us.us<header>,%case4.us15.us.us.us.us.us.us.us,%inner_latch.us20.us.us.us.us.us.us.us<latch><exiting>
Loop at depth 1 containing: %outer_loop.us37.us125.us176.us202<header>,%outer_loop.split.us40.us128.us179.us205,%outer_latch.us41.us.us.us206<latch><exiting>,%outer_loop.split.split.us.us129.us180.us208,%outer_latch.split.us43.us.us.us209,%outer_latch.split.split.us.us130.us.us210,%outer_loop.split.split.split.us.us.us131.us181.us211,%outer_loop.split.split.split.us.split.us.us.us182.us212,%outer_latch.split.split.split.us.us.us.us.us213,%outer_loop.split.split.split.us.split.us.split.us.us.us183.us214,%outer_loop.split.split.split.us.split.us.split.us.split.us.us.us215,%outer_latch.split.split.split.us.us.split.us.us.us.us216,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.us.us.us217,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.split.us.us.us218,%outer_latch.split.split.split.us.us.split.us.split.us.us.us.us219,%outer_latch.split.split.split.us.us.split.us.split.us.us.us.split.us220,%outer_loop.split.split.split.us.split.us.split.us.split.split.us.split.us.us.split.us184.us,%inner_loop.us12.us.us.us.us.us.us185.us,%case3.us16.us.us.us.us.us.us.us,%inner_latch.us20.us.us.us.us.us.us188.us,%outer_latch.split.split.split.us.us.split.us.split.us.us.us.split.split.us.us
    Loop at depth 2 containing: %inner_loop.us12.us.us.us.us.us.us185.us<header>,%case3.us16.us.us.us.us.us.us.us,%inner_latch.us20.us.us.us.us.us.us188.us<latch><exiting>

i.e. the problem is that 'depth 2' messages are indented, and (for some reason) the tests want them all sorted by message.

krytarowski accepted this revision.Dec 2 2018, 5:49 AM
This revision is now accepted and ready to land.Dec 2 2018, 5:49 AM

i.e. the problem is that 'depth 2' messages are indented, and (for some reason) the tests want them all sorted by message.

The tests are trying to count loops at different depths, using -COUNT-<NUM> directives, e.g. 11 loops at depth 1, 40 loops at depth 2.
Alternative to sorting would be to implement support for -COUNT-<NUM>-DAG.

-b was added to sort to fix buildbot failures.
I could only speculate that under certain locales whitespaces might lead to different ordering.

fedor.sergeev accepted this revision.Dec 2 2018, 7:48 AM
This revision was automatically updated to reflect the committed changes.