This is an archive of the discontinued LLVM Phabricator instance.

[SVE][LoopVectorize] Support for vectorization of loops with function calls
ClosedPublic

Authored by kmclaughlin on Feb 9 2021, 10:31 AM.

Details

Summary

Changes getScalarizationOverhead to return an invalid cost for scalable VFs
and adds some simple tests for loops containing a function for which
there is a vectorized variant available.

Diff Detail

Event Timeline

kmclaughlin created this revision.Feb 9 2021, 10:31 AM
kmclaughlin requested review of this revision.Feb 9 2021, 10:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2021, 10:31 AM
david-arm added inline comments.Feb 10 2021, 5:59 AM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
4930

nit: I think we can remove the braces now.

llvm/test/Transforms/LoopVectorize/AArch64/scalable-call.ll
2

Is it worth adding tests for LLVM intrinsics too that use fast math, i.e. test/Transforms/LoopVectorize/PowerPC/widened-massv-vfabi-attr.ll has an example like this:

  %1 = call fast double @llvm.sin.f64(double %conv) #1
  %add = fadd fast double %Sum.0, %1
...
declare double @llvm.sin.f64(double) #0
declare <2 x double> @__sind2_massv(<2 x double>) #0
attributes #0 = { nounwind readnone speculatable willreturn }
attributes #1 = { "vector-function-abi-variant"="_ZGV_LLVM_N2v_llvm.sin.f64(__sind2_massv)" }
kmclaughlin marked 2 inline comments as done.
  • Removed unnecessary braces from widenCallInstruction
  • Added a test for a loop containing an LLVM intrinsic (@llvm.sin.f64)
david-arm accepted this revision.Feb 11 2021, 5:37 AM

LGTM! Thanks for the new test!

This revision is now accepted and ready to land.Feb 11 2021, 5:37 AM
  • Added the -force-vector-interleave=1 flag to the scalable-call.ll
david-arm added inline comments.Feb 11 2021, 5:47 AM
llvm/test/Transforms/LoopVectorize/AArch64/scalable-call.ll
78

nit: If you could make the tests consistent in terms of the numbers of CHECK lines before merging that would be great! Perhaps disable interleaving with -force-vector-interleave=1?