This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Add tests for scalable vectorization of loops with in-order reductions
ClosedPublic

Authored by kmclaughlin on Apr 13 2021, 7:06 AM.

Details

Summary

D98435 added support for in-order reductions and included tests for fixed-width
vectorization with the -enable-strict-reductions flag.

This patch adds similar tests to verify support for scalable vectorization of loops
with in-order reductions.

Diff Detail

Event Timeline

kmclaughlin requested review of this revision.Apr 13 2021, 7:06 AM
kmclaughlin created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2021, 7:06 AM
david-arm added inline comments.Apr 15 2021, 8:35 AM
llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
41

I think this should just be [[RDX4]]

70

nit: Should this be [[STEPVEC1]] instead of %7?

72

Perhaps this should be named VEC_PHI2 to match the LOAD2 and same for the PHI below?

74

nit: I think you can just use {{.*}} here instead of [[VEC_IND_NEXT:.*]] since you don't reference the variable later on.

120

nit: SCALAR isn't used below I think so this can just be {{.*}}

155

nit: Perhaps better named as SELECTED_VALS or something like that, since this isn't really a PHI?

207

Ok, it looks like this test is actually falling back on a non-strict implementation that reorders FP operations. This happens in this case because we are using hints and allowsReordering always return true for hints.

kmclaughlin marked 6 inline comments as done.
  • Addressing review comments
  • Removed -instcombine from the RUN line of scalable-strict-fadd.ll (this was also removed from the fixed-width tests in rG93f54fae9dda)
kmclaughlin added inline comments.Apr 16 2021, 6:36 AM
llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
207

I think I could remove the hints and instead use -force-vector-width/interleave and we would not fall back on the non-strict implementation, if that would be better?

david-arm accepted this revision.Apr 16 2021, 7:09 AM

LGTM! Thanks for making the changes. :)

llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
207

nit: Perhaps you can just clarify in the comment before merging why we still end up reordering here, which is due to the hints permitting reordering?

This revision is now accepted and ready to land.Apr 16 2021, 7:09 AM