This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Add tests for scalable vectorization of loops with large stride acesses
ClosedPublic

Authored by david-arm on Mar 23 2021, 8:26 AM.

Details

Summary

This patch just adds tests that we can vectorize loop such as these:

for (i = 0; i < n; i++)
  dst[i * 7] += 1;

and

for (i = 0; i < n; i++)
  if (cond[i])
    dst[i * 7] += 1;

using scalable vectors, where we expect to use gathers and scatters in the
vectorized loop. The vector of pointers used for the gather is identical
to those used for the scatter so there should be no memory dependences.

Tests are added here:

Transforms/LoopVectorize/AArch64/sve-large-strides.ll

Diff Detail

Event Timeline

david-arm created this revision.Mar 23 2021, 8:26 AM
david-arm requested review of this revision.Mar 23 2021, 8:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2021, 8:26 AM
peterwaller-arm accepted this revision.Mar 31 2021, 2:07 AM

LGTM.

llvm/test/Transforms/LoopVectorize/AArch64/sve-large-strides.ll
2

Optional: I'd understood it was preferred to put the triples and attrs into the IR to make invoking opt manually on the file a little easier.

This revision is now accepted and ready to land.Mar 31 2021, 2:07 AM

Hey David,
I believe I have some nit. :)

llvm/test/Transforms/LoopVectorize/AArch64/sve-large-strides.ll
6

Why do many spaces between CHECK and the instructions?

12

Is there any reason to be more than 1 space?

33

Could this be label too?

david-arm added inline comments.Apr 1 2021, 1:11 AM
llvm/test/Transforms/LoopVectorize/AArch64/sve-large-strides.ll
6

I'm just trying to align the starts of all the instructions, i.e. ensure that '%' lines up in the same column. I think it's a bit easier to read this way. This also matches the behaviour of the automated CHECK line writing tool - utils/update_test_checks.py. For example, I used tests like this as a reference:

test/Transforms/LoopVectorize/X86/invariant-store-vectorization.ll
12

Again, just trying to follow same convention as utils/update_test_checks.py that's all.

33

I think in such cases we normally seem to use CHECK:, at least for tests generated by utils/update_test_checks.py in llvm/test/Transforms/LoopVectorize/X86/

llvm/test/Transforms/LoopVectorize/AArch64/sve-large-strides.ll
12

Oh...that is nice...so I will not have any more problems with formatting tests

CarolineConcatto accepted this revision.Apr 1 2021, 2:24 AM

LGMT David!
Learning new things every day!

This revision was landed with ongoing or failed builds.Apr 1 2021, 2:26 AM
This revision was automatically updated to reflect the committed changes.